Commit 8cef0f37 authored by catch's avatar catch
Browse files

Issue #3204353 by pragati_kanade, ravi.shankar, Chi, longwave: hook_link_alter() wrong example

parent 052fae4f
......@@ -485,7 +485,9 @@ function hook_system_breadcrumb_alter(\Drupal\Core\Breadcrumb\Breadcrumb &$bread
*/
function hook_link_alter(&$variables) {
// Add a warning to the end of route links to the admin section.
if (isset($variables['route_name']) && strpos($variables['route_name'], 'admin') !== FALSE) {
/** @var \Drupal\Core\Url $url */
$url = $variables['url'];
if ($url->isRouted() && strpos($url->getRouteName(), 'admin') !== FALSE) {
$variables['text'] = t('@text (Warning!)', ['@text' => $variables['text']]);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment