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

modules/reviewer_test_kit/src/Plugin/reviewer/Task/Entity/Display/Form/FieldWidgetSettingsTaskBase.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\FieldSettingsTaskBase;

/**
 * Base task for checking the field widget settings on entity display forms.
 *
 * Tasks extending this class only need to define the $expectedValues and one or
 * both of the $fieldTypes or $fieldNames properties; the task takes care of
 * checking and fixing values automatically. $expectedValues values can be
 * prefixed with '!' to match anything but the given value, however, these
 * values cannot be fixed automatically because the correct value is not
 * defined.
 *
 * If $expectedValues 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 paragraphs widgets do not use
 * default titles and always load closed with a summary:
 *
 * @code
 * #[Task(
 *   id: 'paragraph_settings',
 *   module_dependencies: ['paragraphs'],
 * )]
 * final class ParagraphWidgetSettings extends FieldWidgetSettingsTaskBase {
 *
 *   protected array $fieldTypes = [
 *     'paragraphs',
 *   ];
 *
 *   protected array $expectedValues = [
 *     'settings' => [
 *       'title' => '!Paragraph',
 *       'title_plural' => '!Paragraphs',
 *       'edit_mode' => 'closed',
 *       'closed_mode' => 'summary',
 *     ],
 *   ];
 *
 * }
 * @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\FieldSettingsTaskBase::$expectedValues
 */
abstract class FieldWidgetSettingsTaskBase extends FieldSettingsTaskBase {

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

}

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

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