Is it potential to append a marketing campaign monitoring code to Drupal Development requested URL basing on a particular area worth on Drupal Development linked node? I am attempting to make use of a path_processor_outbound service, nevertheless it would not work fairly as anticipated and it really works slightly randomly.
That is Drupal Development code I’m utilizing.
operate processOutbound($path, &$choices = array(), Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {if(isset($choices['entity']) && $choices['entity'] instanceof DrupalnodeNodeInterface ) { $node = $choices['entity']; if($node->bundle() == 'article') { $channel = $node->get('field_channel')->getValue(); $promotions = array(10); $channel_value = reset($channel); $channel_id = $channel_value['target_id']; if(in_array($channel_id, $promotions)) { $choices['query']['foo'] = 'bar'; } } } return $path; }
I’ve a sense that is right method for hyperlinks to nodes generated on website (teasers on entrance web page), nevertheless it would not append parameters on web page request.
I additionally thought-about including parameters to Drupal Development path alias, however that does not appear to be proper and JavaScript code could be added too late.