reviewer-1.2.x-dev/modules/reviewer_test_kit/src/Plugin/reviewer/Task/Entity/Display/View/ViewFieldGroupSettingsTaskBase.php
modules/reviewer_test_kit/src/Plugin/reviewer/Task/Entity/Display/View/ViewFieldGroupSettingsTaskBase.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\FieldGroupSettingsTaskBase;
/**
* Base task for checking the field group settings on entity display views.
*
* 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.
*
* Additionally, the $fieldTypes property for field groups matches the field
* group format_type.
*
* 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 field group fieldsets always
* output labels as HTML.
*
* @code
* #[Task('fieldset_settings')]
* final class FieldsetSettings extends ViewFieldGroupSettingsTaskBase {
*
* protected array $fieldTypes = [
* 'fieldset',
* ];
*
* protected array $expectedValues = [
* 'format_settings' => [
* 'label_as_html' => TRUE,
* ],
* ];
*
* }
* @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 ViewFieldGroupSettingsTaskBase extends FieldGroupSettingsTaskBase {
/**
* {@inheritdoc}
*/
protected string $displayType = 'view';
}
