function MediaTest::getDrupalMediaFromSource
Parses the <drupal-media> element from CKEditor's "source" view.
Assumes CKEditor is in source mode.
Return value
\DOMNode|null The drupal-media element or NULL if it can't be found.
3 calls to MediaTest::getDrupalMediaFromSource()
- MediaTest::assertSourceAttributeSame in core/
modules/ ckeditor/ tests/ src/ FunctionalJavascript/ MediaTest.php - Verifies value of an attribute on the downcast <drupal-media> element.
- MediaTest::testAlignment in core/
modules/ ckeditor/ tests/ src/ FunctionalJavascript/ MediaTest.php - Tests alignment integration.
- MediaTest::testViewMode in core/
modules/ ckeditor/ tests/ src/ FunctionalJavascript/ MediaTest.php - Tests the EditorMediaDialog can set the data-view-mode attribute.
File
-
core/
modules/ ckeditor/ tests/ src/ FunctionalJavascript/ MediaTest.php, line 1594
Class
- MediaTest
- @coversDefaultClass \Drupal\ckeditor\Plugin\CKEditorPlugin\DrupalMedia @group ckeditor @group legacy
Namespace
Drupal\Tests\ckeditor\FunctionalJavascriptCode
protected function getDrupalMediaFromSource() {
$value = $this->assertSession()
->elementExists('css', 'textarea.cke_source')
->getValue();
$dom = Html::load($value);
$xpath = new \DOMXPath($dom);
$list = $xpath->query('//drupal-media');
return count($list) > 0 ? $list[0] : NULL;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.