Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / entity_view_display_alter.twig
1 /**
2  * Implements hook_entity_view_display_alter().
3  */
4 function {{ machine_name }}_entity_view_display_alter(\Drupal\Core\Entity\Display\EntityViewDisplayInterface $display, array $context) {
5   // Leave field labels out of the search index.
6   if ($context['entity_type'] == 'node' && $context['view_mode'] == 'search_index') {
7     foreach ($display->getComponents() as $name => $options) {
8       if (isset($options['label'])) {
9         $options['label'] = 'hidden';
10         $display->setComponent($name, $options);
11       }
12     }
13   }
14 }