function StyleTest::getHtmlDom

Same name in other branches
  1. 9 core/modules/views/tests/src/Kernel/Plugin/StyleTest.php \Drupal\Tests\views\Kernel\Plugin\StyleTest::getHtmlDom()
  2. 8.9.x core/modules/views/tests/src/Kernel/Plugin/StyleTest.php \Drupal\Tests\views\Kernel\Plugin\StyleTest::getHtmlDom()
  3. 11.x core/modules/views/tests/src/Kernel/Plugin/StyleTest.php \Drupal\Tests\views\Kernel\Plugin\StyleTest::getHtmlDom()

Returns a view output as SimpleXMLElement.

Return value

\SimpleXMLElement|null The HTML DOM.

1 call to StyleTest::getHtmlDom()
StyleTest::testCustomRowClasses in core/modules/views/tests/src/Kernel/Plugin/StyleTest.php
Tests custom CSS row classes.

File

core/modules/views/tests/src/Kernel/Plugin/StyleTest.php, line 314

Class

StyleTest
Tests general style functionality.

Namespace

Drupal\Tests\views\Kernel\Plugin

Code

protected function getHtmlDom($output) {
    $html_dom = Html::load($output);
    if ($html_dom) {
        // It's much easier to work with simplexml than DOM, luckily enough
        // we can just simply import our DOM tree.
        return simplexml_import_dom($html_dom);
    }
    return NULL;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.