function comment_display_configurable_test_entity_base_field_info_alter

Same name and namespace in other branches
  1. 9 core/modules/comment/tests/modules/comment_display_configurable_test/comment_display_configurable_test.module \comment_display_configurable_test_entity_base_field_info_alter()
  2. 10 core/modules/comment/tests/modules/comment_display_configurable_test/comment_display_configurable_test.module \comment_display_configurable_test_entity_base_field_info_alter()

Implements hook_entity_base_field_info_alter().

File

core/modules/comment/tests/modules/comment_display_configurable_test/comment_display_configurable_test.module, line 13

Code

function comment_display_configurable_test_entity_base_field_info_alter(&$base_field_definitions, EntityTypeInterface $entity_type) {
    if ($entity_type->id() == 'comment') {
        foreach ([
            'created',
            'uid',
            'pid',
            'subject',
        ] 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.