Skip to content
Snippets Groups Projects
Commit 19714f20 authored by Michael Lee's avatar Michael Lee
Browse files

Add hook to add a11y text to file media

parent 8d3daa53
No related branches found
No related tags found
1 merge request!159Add hook to add a11y text to file media
...@@ -1141,3 +1141,17 @@ function asc_bootstrap_bux_preprocess_views_exposed_form(&$variables) ...@@ -1141,3 +1141,17 @@ function asc_bootstrap_bux_preprocess_views_exposed_form(&$variables)
} }
} }
} }
/**
* Appends accessible text to File media when it opens in a new tab.
*/
function asc_bootstrap_bux_preprocess_file_link(array &$variables)
{
$link = $variables['link'];
$attributes = $link->getUrl()->getOption('attributes');
if (isset($attributes['target']) && $attributes['target'] === '_blank') {
$string = $link->getText();
$string .= " (opens in a new window)";
$link->setText($string);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment