metatag-8.x-1.x-dev/tests/modules/metatag_test_custom_route/metatag_test_custom_route.module
tests/modules/metatag_test_custom_route/metatag_test_custom_route.module
<?php
/**
* @file
* Contains metatag_test_custom_route.module..
*/
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
/**
* Implements hook_help().
*/
function metatag_test_custom_route_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the metatag_test_custom_route module.
case 'help.page.metatag_test_custom_route':
$output = '';
$output .= '<h3>' . (string) new TranslatableMarkup('About') . '</h3>';
$output .= '<p>' . (string) new TranslatableMarkup('Support module for testing handling of a custom route.') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_metatag_route_entity().
*/
function metatag_test_custom_route_metatag_route_entity(RouteMatchInterface $route_match) {
if ($route_match->getRouteName() === 'metatag_test_custom_route.entity_route') {
if ($entity_test = $route_match->getParameter('entity_test')) {
return $entity_test;
}
}
}
