2 * Implements hook_ENTITY_TYPE_view_alter().
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'])) {
7 $build['an_additional_field']['#weight'] = -10;
9 // Add a #post_render callback to act on the rendered HTML of the entity.
10 $build['#post_render'][] = 'my_module_node_post_render';