/** * Tests the Html::getUniqueId() method. * * @param string $expected * The expected result. * @param string $source * The string being transformed to an ID. * @param bool $reset * (optional) If TRUE, reset the list of seen IDs. Defaults to FALSE. * * @dataProvider providerTestHtmlGetUniqueIdWithAjaxIds * * @covers ::getUniqueId */ public function testHtmlGetUniqueIdWithAjaxIds($expected, $source, $reset = FALSE) { if ($reset) { Html::resetSeenIds(); } Html::setAjaxHtmlIds('test-unique-id1 test-unique-id2--3'); $this->assertSame($expected, Html::getUniqueId($source)); }
/** * Sets the AJAX HTML IDs from the current request. * * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event * The response event, which contains the current request. */ public function onRequest(GetResponseEvent $event) { Html::setAjaxHtmlIds($event->getRequest()->request->get('ajax_html_ids', '')); }