<?php

/**
 * @file
 * Hook implementation for the layout_builder_browser_library module.
 */

declare(strict_types=1);

use Drupal\Core\Form\FormStateInterface;
use Drupal\layout_builder_browser_library\HookHandler\FormLayoutBuilderBrowserBlockAlter;

/**
 * Implements hook_form_FORM_ID_alter() for 'layout_builder_browser_block_add_form'.
 */
function layout_builder_browser_library_form_layout_builder_browser_block_add_form_alter(array &$form, FormStateInterface $form_state, string $form_id): void {
  /** @var \Drupal\layout_builder_browser_library\HookHandler\FormLayoutBuilderBrowserBlockAlter $instance */
  $instance = \Drupal::service('class_resolver')
    ->getInstanceFromDefinition(FormLayoutBuilderBrowserBlockAlter::class);
  $instance->formAlter($form, $form_state);
}

/**
 * Implements hook_form_FORM_ID_alter() for 'layout_builder_browser_block_edit_form'.
 */
function layout_builder_browser_library_form_layout_builder_browser_block_edit_form_alter(array &$form, FormStateInterface $form_state, string $form_id): void {
  /** @var \Drupal\layout_builder_browser_library\HookHandler\FormLayoutBuilderBrowserBlockAlter $instance */
  $instance = \Drupal::service('class_resolver')
    ->getInstanceFromDefinition(FormLayoutBuilderBrowserBlockAlter::class);
  $instance->formAlter($form, $form_state);
}
