How to rename page_name or unset page_name and page_url

Last updated on
10 December 2018

Implement your own EventSubscriber..

Example:


namespace Drupal\example_module\EventSubscriber;

use Drupal\tealiumiq\Event\AlterUdoPropertiesEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
 * {@inheritdoc}
 */
class ExampleTealiumSubscriber implements EventSubscriberInterface {

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[AlterUdoPropertiesEvent::UDO_ALTER_PROPERTIES] = 'alterTealiumExampleProperties';
    return $events;
  }

  /**
   * Alter Tealium Properties.
   *
   * @param \Drupal\tealiumiq\Event\AlterUdoPropertiesEvent $event
   *   Alter Udo Properties Event.
   */
  public function alterTealiumExampleProperties(AlterUdoPropertiesEvent $event) {
    $properties = $event->getProperties();
    unset($properties['page_name']);
    unset($properties['page_url']);
    $event->setProperties($properties);
  }

}

Help improve this page

Page status: No known problems

You can: