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

Add check to preprocess file link hook to not run on webforms

parent 096c35f7
No related branches found
No related tags found
1 merge request!163Add check to preprocess file link hook to not run on webforms
......@@ -1147,11 +1147,14 @@ function asc_bootstrap_bux_preprocess_views_exposed_form(&$variables)
*/
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);
$route_name = \Drupal::routeMatch()->getRouteName();
if ($route_name !== "entity.webform.canonical") {
$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