I want to alter url of a field and his display.
The field is a taxonomy label with link to the entity.
The default url is : taxonomy/term/{tid}
I wanto to chage with : my_specific_page?technologie={tid}
(used to prepopulate exposed filter)
I tried with :
function MYTHEME_preprocess_field__field_technologie(&$variables, $hook){
$element = $variables['element'];
foreach ($variables['items'] as $item) {
$route_name = 'entity.node.canonical';
$params = 39;
$options = [
'query' => ['technologie' => 27],
];
$url = Url::fromRoute($route_name, array('node' => $params), $options);
$item['content']['#url'] = $url;
}
}
I think i need to replace routeName attribut, but how ?
Content type : "manage field" Content type : "manage display" Kint result $variables['element'] []3