function NodeDisplayConfigurableTestHooks::entityBaseFieldInfoAlter

Implements hook_entity_base_field_info_alter().

File

core/modules/node/tests/modules/node_display_configurable_test/src/Hook/NodeDisplayConfigurableTestHooks.php, line 18

Class

NodeDisplayConfigurableTestHooks
Hook implementations for node_display_configurable_test.

Namespace

Drupal\node_display_configurable_test\Hook

Code

public function entityBaseFieldInfoAlter(&$base_field_definitions, EntityTypeInterface $entity_type) : void {
    if ($entity_type->id() == 'node') {
        foreach ([
            'created',
            'uid',
            'title',
        ] as $field) {
            
            /** @var \Drupal\Core\Field\BaseFieldDefinition[] $base_field_definitions */
            $base_field_definitions[$field]->setDisplayConfigurable('view', TRUE);
        }
    }
}

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