description.html.twig

Same filename in this branch
  1. 8.x-1.x menu_example/templates/description.html.twig
  2. 8.x-1.x form_api_example/templates/description.html.twig
  3. 8.x-1.x js_example/templates/description.html.twig
  4. 8.x-1.x page_example/templates/description.html.twig
  5. 8.x-1.x node_type_example/templates/description.html.twig
  6. 8.x-1.x pager_example/templates/description.html.twig
  7. 8.x-1.x block_example/templates/description.html.twig
  8. 8.x-1.x tabledrag_example/templates/description.html.twig
  9. 8.x-1.x testing_example/templates/description.html.twig
  10. 8.x-1.x tour_example/templates/description.html.twig
  11. 8.x-1.x config_entity_example/templates/description.html.twig
  12. 8.x-1.x tests/modules/examples_description_test/templates/description.html.twig
  13. 8.x-1.x phpunit_example/templates/description.html.twig
  14. 8.x-1.x render_example/templates/description.html.twig
  15. 8.x-1.x field_permission_example/templates/description.html.twig
  16. 8.x-1.x stream_wrapper_example/templates/description.html.twig
  17. 8.x-1.x ajax_example/templates/description.html.twig
  18. 8.x-1.x field_example/templates/description.html.twig
Same filename in other branches
  1. 3.x modules/menu_example/templates/description.html.twig
  2. 3.x modules/form_api_example/templates/description.html.twig
  3. 3.x modules/js_example/templates/description.html.twig
  4. 3.x modules/page_example/templates/description.html.twig
  5. 3.x modules/node_type_example/templates/description.html.twig
  6. 3.x modules/pager_example/templates/description.html.twig
  7. 3.x modules/block_example/templates/description.html.twig
  8. 3.x modules/tabledrag_example/templates/description.html.twig
  9. 3.x modules/rest_example/templates/description.html.twig
  10. 3.x modules/testing_example/templates/description.html.twig
  11. 3.x modules/tour_example/templates/description.html.twig
  12. 3.x modules/config_entity_example/templates/description.html.twig
  13. 3.x modules/phpunit_example/templates/description.html.twig
  14. 3.x modules/render_example/templates/description.html.twig
  15. 3.x modules/field_permission_example/templates/description.html.twig
  16. 3.x modules/stream_wrapper_example/templates/description.html.twig
  17. 3.x modules/ajax_example/templates/description.html.twig
  18. 3.x modules/hooks_example/templates/description.html.twig
  19. 3.x modules/field_example/templates/description.html.twig
  20. 3.x tests/modules/examples_description_test/templates/description.html.twig
  21. 4.0.x modules/menu_example/templates/description.html.twig
  22. 4.0.x modules/form_api_example/templates/description.html.twig
  23. 4.0.x modules/js_example/templates/description.html.twig
  24. 4.0.x modules/page_example/templates/description.html.twig
  25. 4.0.x modules/node_type_example/templates/description.html.twig
  26. 4.0.x modules/pager_example/templates/description.html.twig
  27. 4.0.x modules/block_example/templates/description.html.twig
  28. 4.0.x modules/tabledrag_example/templates/description.html.twig
  29. 4.0.x modules/rest_example/templates/description.html.twig
  30. 4.0.x modules/testing_example/templates/description.html.twig
  31. 4.0.x modules/tour_example/templates/description.html.twig
  32. 4.0.x modules/config_entity_example/templates/description.html.twig
  33. 4.0.x modules/phpunit_example/templates/description.html.twig
  34. 4.0.x modules/render_example/templates/description.html.twig
  35. 4.0.x modules/field_permission_example/templates/description.html.twig
  36. 4.0.x modules/stream_wrapper_example/templates/description.html.twig
  37. 4.0.x modules/ajax_example/templates/description.html.twig
  38. 4.0.x modules/hooks_example/templates/description.html.twig
  39. 4.0.x modules/field_example/templates/description.html.twig
  40. 4.0.x tests/modules/examples_description_test/templates/description.html.twig
  41. 4.0.x modules/config_simple_example/templates/description.html.twig
{#

Description text for the Hooks Example.

#}

{% set help_hooks_example = path('help.page', {'name': 'hooks_example'}) %}
{% set node_add_page = path('node.add_page') %}
{% set user_login = path('user.login') %}

{% trans %}

Implementing, defining, and invoking hooks

The code in this module implements a couple of new features which you can see in action.

Implements hook_help(): In hooks_example.module you'll find an implementation of the hook hook_help() which is used to add contents to this module's help overview. Visible at admin/help/hooks_example.

View counts: hooks_example_node_view() is an implementation of the hook hook_ENTITY_TYPE_view() that adds a basic page view counter. You can see this in action by navigating to any node on the site and looking for the the text telling you how many times you've viewed that page.

Don't have any nodes? Add some and look at their counters.

Implements hook_form_alter(): In hooks_example.module you'll find an implementation of hook_form_alter() which demonstrates the use of one of the most commonly used alter hooks. You can view the altered form at user/login.

To learn more about how to implement an existing hook, or how to define and invoke a new hook start by reading the @docblock comments in hooks_example.module.

{% endtrans %}

File

hooks_example/templates/description.html.twig

View source
  1. {#
  2. Description text for the Hooks Example.
  3. #}
  4. {% set help_hooks_example = path('help.page', {'name': 'hooks_example'}) %}
  5. {% set node_add_page = path('node.add_page') %}
  6. {% set user_login = path('user.login') %}
  7. {% trans %}
  8. <h2>Implementing, defining, and invoking hooks</h2>
  9. <p>The code in this module implements a couple of new features which you can see
  10. in action.</p>
  11. <p><strong>Implements <code>hook_help()</code>:</strong> In
  12. <code>hooks_example.module</code> you'll find an implementation of the
  13. <code>hook hook_help()</code> which is used to add contents to this module's
  14. help overview. Visible at <a href={{ help_hooks_example }}>
  15. <code>admin/help/hooks_example</code></a>.</p>
  16. <p><strong>View counts:</strong> <code>hooks_example_node_view()</code> is an
  17. implementation of the hook <code>hook_ENTITY_TYPE_view()</code> that adds a
  18. basic page view counter. You can see this in action by navigating to any node on
  19. the site and looking for the the text telling you how many times you've viewed
  20. that page.</p>
  21. <p>Don't have any nodes? <a href={{ node_add_page }}>Add some</a> and look at
  22. their counters.</p>
  23. <p><strong>Implements <code>hook_form_alter()</code>:</strong> In
  24. <code>hooks_example.module</code> you'll find an implementation of
  25. <code>hook_form_alter()</code> which demonstrates the use of one of the most
  26. commonly used alter hooks. You can view the altered form at
  27. <a href={{ user_login }}><code>user/login</code></a>.</p>
  28. <p>To learn more about how to implement an existing hook, or how to define and
  29. invoke a new hook start by reading the <code>@docblock</code> comments in
  30. <code>hooks_example.module</code>.</p>
  31. {% endtrans %}