inline_image_saver-1.0.x-dev/tests/inline_image_saver_ui_test/src/Hook/InlineImageSaverUiTestHooks.php

tests/inline_image_saver_ui_test/src/Hook/InlineImageSaverUiTestHooks.php
<?php

declare(strict_types=1);

namespace Drupal\inline_image_saver_ui_test\Hook;

use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Hook\Attribute\Hook;
use Drupal\Core\State\StateInterface;

/**
 * Hook implementations for inline_image_saver_ui_test.
 */
class InlineImageSaverUiTestHooks {

  public function __construct(protected readonly StateInterface $state) {}

  /**
   * Implements hook_entity_base_field_info_alter().
   */
  #[Hook('entity_base_field_info_alter')]
  public function entityBaseFieldInfoAlter(array &$fields, EntityTypeInterface $entity_type): void {
    if ($entity_type->id() !== 'node') {
      return;
    }
    $field_name = 'base_text_long';
    $fields[$field_name] = BaseFieldDefinition::create('text_long')
      ->setName($field_name)
      ->setLabel($field_name)
      ->setDisplayOptions('form', ['region' => 'content'])
      ->setDisplayOptions('view', ['region' => 'content']);
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc