computed_field-8.x-2.x-dev/tests/modules/test_computed_field_automatic/src/Plugin/ComputedField/TestStringDirectBaseUnused.php
tests/modules/test_computed_field_automatic/src/Plugin/ComputedField/TestStringDirectBaseUnused.php
<?php
namespace Drupal\test_computed_field_automatic\Plugin\ComputedField;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\computed_field\Attribute\ComputedField;
use Drupal\computed_field\Field\ComputedFieldDefinitionWithValuePluginInterface;
use Drupal\computed_field\Plugin\ComputedField\SingleValueTrait;
use Drupal\computed_field\Plugin\ComputedField\ComputedFieldBase;
use Drupal\Core\Entity\EntityInterface;
/**
* Automatic base field which should not appear in the test.
*/
#[ComputedField(
id: 'test_string_automatic_base',
label: new TranslatableMarkup('Test String Automatic'),
field_type: 'string',
no_ui: TRUE,
attach: [
'scope' => 'base',
'field_name' => 'test_automatic_base_unused',
'entity_types' => ['unused_entity_type' => []],
],
)]
class TestStringDirectBaseUnused extends ComputedFieldBase {
use SingleValueTrait;
/**
* {@inheritdoc}
*/
public function singleComputeValue(EntityInterface $host_entity, ComputedFieldDefinitionWithValuePluginInterface $computed_field_definition): mixed {
return 'cake!';
}
}
