reviewer-1.2.x-dev/modules/reviewer_test_kit/src/Plugin/reviewer/Task/Entity/Display/View/FieldFormatterSettingsTaskBase.php
modules/reviewer_test_kit/src/Plugin/reviewer/Task/Entity/Display/View/FieldFormatterSettingsTaskBase.php
<?php
declare(strict_types=1);
namespace Drupal\reviewer_test_kit\Plugin\reviewer\Task\Entity\Display\View;
use Drupal\reviewer_test_kit\Plugin\reviewer\Task\Entity\Display\FieldSettingsTaskBase;
/**
* Base task for checking the field formatter settings on entity display views.
*
* Tasks extending this class only need to define the $expectedValues and ore 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 all field labels are hidden:
*
* @code
* #[Task('label_hidden')]
* class LabelHidden extends FieldFormatterSettingsTaskBase {
*
* protected array $fieldNames = ['*'];
*
* protected array $expectedValues = [
* 'label' => 'hidden',
* ];
*
* }
* @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 FieldFormatterSettingsTaskBase extends FieldSettingsTaskBase {
/**
* {@inheritdoc}
*/
protected string $displayType = 'view';
}
