description.html.twig
Same filename in this branch
- 8.x-1.x menu_example/templates/description.html.twig
- 8.x-1.x form_api_example/templates/description.html.twig
- 8.x-1.x js_example/templates/description.html.twig
- 8.x-1.x page_example/templates/description.html.twig
- 8.x-1.x node_type_example/templates/description.html.twig
- 8.x-1.x pager_example/templates/description.html.twig
- 8.x-1.x block_example/templates/description.html.twig
- 8.x-1.x tabledrag_example/templates/description.html.twig
- 8.x-1.x testing_example/templates/description.html.twig
- 8.x-1.x tour_example/templates/description.html.twig
- 8.x-1.x config_entity_example/templates/description.html.twig
- 8.x-1.x tests/modules/examples_description_test/templates/description.html.twig
- 8.x-1.x phpunit_example/templates/description.html.twig
- 8.x-1.x render_example/templates/description.html.twig
- 8.x-1.x field_permission_example/templates/description.html.twig
- 8.x-1.x stream_wrapper_example/templates/description.html.twig
- 8.x-1.x ajax_example/templates/description.html.twig
- 8.x-1.x field_example/templates/description.html.twig
Same filename in other branches
- 3.x modules/menu_example/templates/description.html.twig
- 3.x modules/form_api_example/templates/description.html.twig
- 3.x modules/js_example/templates/description.html.twig
- 3.x modules/page_example/templates/description.html.twig
- 3.x modules/node_type_example/templates/description.html.twig
- 3.x modules/pager_example/templates/description.html.twig
- 3.x modules/block_example/templates/description.html.twig
- 3.x modules/tabledrag_example/templates/description.html.twig
- 3.x modules/rest_example/templates/description.html.twig
- 3.x modules/testing_example/templates/description.html.twig
- 3.x modules/tour_example/templates/description.html.twig
- 3.x modules/config_entity_example/templates/description.html.twig
- 3.x modules/phpunit_example/templates/description.html.twig
- 3.x modules/render_example/templates/description.html.twig
- 3.x modules/field_permission_example/templates/description.html.twig
- 3.x modules/stream_wrapper_example/templates/description.html.twig
- 3.x modules/ajax_example/templates/description.html.twig
- 3.x modules/hooks_example/templates/description.html.twig
- 3.x modules/field_example/templates/description.html.twig
- 3.x tests/modules/examples_description_test/templates/description.html.twig
- 4.0.x modules/menu_example/templates/description.html.twig
- 4.0.x modules/form_api_example/templates/description.html.twig
- 4.0.x modules/js_example/templates/description.html.twig
- 4.0.x modules/page_example/templates/description.html.twig
- 4.0.x modules/node_type_example/templates/description.html.twig
- 4.0.x modules/pager_example/templates/description.html.twig
- 4.0.x modules/block_example/templates/description.html.twig
- 4.0.x modules/tabledrag_example/templates/description.html.twig
- 4.0.x modules/rest_example/templates/description.html.twig
- 4.0.x modules/testing_example/templates/description.html.twig
- 4.0.x modules/tour_example/templates/description.html.twig
- 4.0.x modules/config_entity_example/templates/description.html.twig
- 4.0.x modules/phpunit_example/templates/description.html.twig
- 4.0.x modules/render_example/templates/description.html.twig
- 4.0.x modules/field_permission_example/templates/description.html.twig
- 4.0.x modules/stream_wrapper_example/templates/description.html.twig
- 4.0.x modules/ajax_example/templates/description.html.twig
- 4.0.x modules/hooks_example/templates/description.html.twig
- 4.0.x modules/field_example/templates/description.html.twig
- 4.0.x tests/modules/examples_description_test/templates/description.html.twig
- 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()
: Inhooks_example.module
you'll find an implementation of thehook hook_help()
which is used to add contents to this module's help overview. Visible atadmin/help/hooks_example
.View counts:
hooks_example_node_view()
is an implementation of the hookhook_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()
: Inhooks_example.module
you'll find an implementation ofhook_form_alter()
which demonstrates the use of one of the most commonly used alter hooks. You can view the altered form atuser/login
.To learn more about how to implement an existing hook, or how to define and invoke a new hook start by reading the
{% endtrans %}@docblock
comments inhooks_example.module
.
File
-
hooks_example/
templates/ description.html.twig
View source
- {#
-
- 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 %}
-
- <h2>Implementing, defining, and invoking hooks</h2>
-
- <p>The code in this module implements a couple of new features which you can see
- in action.</p>
-
- <p><strong>Implements <code>hook_help()</code>:</strong> In
- <code>hooks_example.module</code> you'll find an implementation of the
- <code>hook hook_help()</code> which is used to add contents to this module's
- help overview. Visible at <a href={{ help_hooks_example }}>
- <code>admin/help/hooks_example</code></a>.</p>
-
- <p><strong>View counts:</strong> <code>hooks_example_node_view()</code> is an
- implementation of the hook <code>hook_ENTITY_TYPE_view()</code> 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.</p>
-
- <p>Don't have any nodes? <a href={{ node_add_page }}>Add some</a> and look at
- their counters.</p>
-
- <p><strong>Implements <code>hook_form_alter()</code>:</strong> In
- <code>hooks_example.module</code> you'll find an implementation of
- <code>hook_form_alter()</code> which demonstrates the use of one of the most
- commonly used alter hooks. You can view the altered form at
- <a href={{ user_login }}><code>user/login</code></a>.</p>
-
- <p>To learn more about how to implement an existing hook, or how to define and
- invoke a new hook start by reading the <code>@docblock</code> comments in
- <code>hooks_example.module</code>.</p>
-
- {% endtrans %}