You are here

function manage_display_entity_type_build in Manage display 8

Implements hook_entity_type_build().

File

./manage_display.module, line 14
Make base fields such as 'title' available in "Manage Display".

Code

function manage_display_entity_type_build(array &$entity_types) {
  $attributes = [
    'enable_base_field_custom_preprocess_skipping' => [
      'node',
      'taxonomy_term',
      'aggregator_feed',
      'aggregator_item',
    ],
    'enable_page_title_template' => [
      'node',
      'taxonomy_term',
      'aggregator_feed',
      'media',
    ],
  ];
  foreach ($attributes as $property => $types) {
    foreach ($types as $type) {
      if (isset($entity_types[$type])) {
        $entity_types[$type]
          ->set($property, TRUE);
      }
    }
  }
  if (isset($entity_types['user'])) {

    // Set user name as a label else it gets printed twice on the user page.
    $keys = $entity_types['user']
      ->get('entity_keys');
    $keys['label'] = 'name';
    $keys = $entity_types['user']
      ->set('entity_keys', $keys);
  }
}