TestItemWithDependencies.php

Same filename in other branches
  1. 8.9.x core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItemWithDependencies.php
  2. 10 core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItemWithDependencies.php
  3. 11.x core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItemWithDependencies.php

Namespace

Drupal\field_test\Plugin\Field\FieldType

File

core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItemWithDependencies.php

View source
<?php

namespace Drupal\field_test\Plugin\Field\FieldType;

use Drupal\Core\Field\FieldDefinitionInterface;

/**
 * Defines the 'test_field_with_dependencies' entity field item.
 *
 * @FieldType(
 *   id = "test_field_with_dependencies",
 *   label = @Translation("Test field with dependencies"),
 *   description = @Translation("Dummy field type used for tests."),
 *   default_widget = "test_field_widget",
 *   default_formatter = "field_test_default",
 *   config_dependencies = {
 *     "module" = {
 *       "test_module"
 *     }
 *   }
 * )
 */
class TestItemWithDependencies extends TestItem {
    
    /**
     * {@inheritdoc}
     */
    public static function calculateDependencies(FieldDefinitionInterface $field_definition) {
        return [
            'content' => [
                'node:article:uuid',
            ],
        ];
    }

}

Classes

Title Deprecated Summary
TestItemWithDependencies Defines the 'test_field_with_dependencies' entity field item.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.