reviewer-1.2.x-dev/modules/reviewer_test_kit/src/Plugin/reviewer/Task/Entity/Display/Form/FieldWidgetsTaskBase.php

modules/reviewer_test_kit/src/Plugin/reviewer/Task/Entity/Display/Form/FieldWidgetsTaskBase.php
<?php

declare(strict_types=1);

namespace Drupal\reviewer_test_kit\Plugin\reviewer\Task\Entity\Display\Form;

use Drupal\reviewer_test_kit\Plugin\reviewer\Task\Entity\Display\FieldPluginsTaskBase;

/**
 * Base task for checking the field widgets on entity form display forms.
 *
 * Tasks extending this class only need to define the $allowedPlugins and one or
 * both of the $fieldTypes or $fieldNames properties; the task takes care of
 * checking and fixing values automatically. If there is only one allowed
 * plugin, then this task can fix errors. If there is more than one allowed
 * plugin, then the task cannot fix errors because the task cannot determine the
 * correct state.
 *
 * If $allowedPlugins is empty, a \LogicException will be thrown. Tasks
 * extending this class also must define either the $fieldTypes or $fieldNames
 * properties. If both properties are empty, a \LogicException will be thrown.
 *
 * Example of a fixable task which checks that entity reference fields using the
 * media handler use the media library widget:
 *
 * @code
 * #[Task('media_widget')]
 * final class MediaFieldWidget extends FieldWidgetsTaskBase {
 *
 *   protected array $fieldTypes = [
 *     'default:media' => 'entity_reference',
 *   ];
 *
 *   protected array $allowed = [
 *     'media_library_widget',
 *   ];
 *
 * }
 * @endcode
 *
 * @see \Drupal\reviewer_test_kit\Plugin\reviewer\Task\Entity\Display\DisplayTaskBase::$displayType
 * @see \Drupal\reviewer_test_kit\Plugin\reviewer\Task\Entity\Display\DisplayFieldsTaskBase::$fieldTypes
 * @see \Drupal\reviewer_test_kit\Plugin\reviewer\Task\Entity\Display\DisplayFieldsTaskBase::$fieldNames
 * @see \Drupal\reviewer_test_kit\Plugin\reviewer\Task\Entity\Display\FieldPluginsTaskBase::$allowedPlugins
 */
abstract class FieldWidgetsTaskBase extends FieldPluginsTaskBase {

  /**
   * {@inheritdoc}
   */
  protected string $displayType = 'form';

}

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

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