Goetas\Twital\EventSubscriber\IDNodeSubscriber::removeAttribute PHP Method

removeAttribute() public method

public removeAttribute ( TemplateEvent $event )
$event Goetas\Twital\EventDispatcher\TemplateEvent
    public function removeAttribute(TemplateEvent $event)
    {
        $doc = $event->getTemplate()->getDocument();
        $xp = new \DOMXPath($doc);
        $xp->registerNamespace('twital', Twital::NS);
        $attributes = $xp->query("//@twital:__internal-id__");
        foreach ($attributes as $attribute) {
            $attribute->ownerElement->removeAttributeNode($attribute);
        }
    }