Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / ENTITY_TYPE_view_alter.twig
1 /**
2  * Implements hook_ENTITY_TYPE_view_alter().
3  */
4 function {{ machine_name }}_ENTITY_TYPE_view_alter(array &$build, Drupal\Core\Entity\EntityInterface $entity, \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display) {
5   if ($build['#view_mode'] == 'full' && isset($build['an_additional_field'])) {
6     // Change its weight.
7     $build['an_additional_field']['#weight'] = -10;
8
9     // Add a #post_render callback to act on the rendered HTML of the entity.
10     $build['#post_render'][] = 'my_module_node_post_render';
11   }
12 }