Version 1
[yaffs-website] / web / modules / contrib / metatag / metatag.api.php
1 <?php
2
3 /**
4  * @file
5  * Document all supported APIs.
6  */
7
8 /**
9  * Provides a ability to integrate alternative routes with metatags.
10  *
11  * Return an entity when the given route/route parameters matches a certain
12  * entity. All metatags will be rendered on that page.
13  *
14  * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
15  *   The route match.
16  *
17  * @return \Drupal\Core\Entity\EntityInterface|null
18  *   Return an entity, if the route should use metatags.
19  */
20 function hook_metatag_route_entity(\Drupal\Core\Routing\RouteMatchInterface $route_match) {
21   if ($route_match->getRouteName() === 'example.test_route') {
22     if ($node = $route_match->getParameter('node')) {
23       return $node;
24     }
25   }
26 }