X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fchi-teck%2Fdrupal-code-generator%2Ftemplates%2Fd8%2Fhook%2FENTITY_TYPE_view.twig;fp=vendor%2Fchi-teck%2Fdrupal-code-generator%2Ftemplates%2Fd8%2Fhook%2FENTITY_TYPE_view.twig;h=dd53624ce94e410b40587f62d2842f8eecccfa5c;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hp=0000000000000000000000000000000000000000;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0;p=yaffs-website diff --git a/vendor/chi-teck/drupal-code-generator/templates/d8/hook/ENTITY_TYPE_view.twig b/vendor/chi-teck/drupal-code-generator/templates/d8/hook/ENTITY_TYPE_view.twig new file mode 100644 index 000000000..dd53624ce --- /dev/null +++ b/vendor/chi-teck/drupal-code-generator/templates/d8/hook/ENTITY_TYPE_view.twig @@ -0,0 +1,14 @@ +/** + * Implements hook_ENTITY_TYPE_view(). + */ +function {{ machine_name }}_ENTITY_TYPE_view(array &$build, \Drupal\Core\Entity\EntityInterface $entity, \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display, $view_mode) { + // Only do the extra work if the component is configured to be displayed. + // This assumes a 'mymodule_addition' extra field has been defined for the + // entity bundle in hook_entity_extra_field_info(). + if ($display->getComponent('mymodule_addition')) { + $build['mymodule_addition'] = [ + '#markup' => mymodule_addition($entity), + '#theme' => 'mymodule_my_additional_field', + ]; + } +}