Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Render.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\FieldType\RichText\Converter;
8
9 use eZ\Publish\Core\FieldType\RichText\RendererInterface;
10 use DOMElement;
11 use DOMNode;
12
18 abstract class Render
19 {
21 protected $renderer;
22
23 public function __construct(RendererInterface $renderer)
24 {
25 $this->renderer = $renderer;
26 }
27
35 protected function extractConfiguration(DOMElement $embed)
36 {
37 $hash = [];
38 $configElements = $embed->getElementsByTagName('ezconfig');
39
40 if ($configElements->length) {
41 $hash = $this->extractHash($configElements->item(0));
42 }
43
44 return $hash;
45 }
46
54 protected function extractHash(DOMNode $configHash)
55 {
56 $hash = [];
57
58 foreach ($configHash->childNodes as $node) {
60 if ($node->nodeType === XML_ELEMENT_NODE) {
61 $hash[$node->getAttribute('key')] = $this->extractHash($node);
62 } elseif ($node->nodeType === XML_TEXT_NODE && !$node->isWhitespaceInElementContent()) {
63 return $node->wholeText;
64 }
65 }
66
67 return $hash;
68 }
69 }
eZ\Publish\Core\FieldType\RichText\Converter\Render
Base class for Render converters.
Definition: Render.php:19
eZ\Publish\Core\FieldType\RichText\Converter\Render\__construct
__construct(RendererInterface $renderer)
Definition: Render.php:23
eZ\Publish\Core\FieldType\RichText\Converter\Render\extractConfiguration
extractConfiguration(DOMElement $embed)
Extracts configuration hash from embed element.
Definition: Render.php:35
eZ\Publish\Core\FieldType\RichText\Converter\Render\$renderer
$renderer
Definition: Render.php:21
eZ\Publish\Core\FieldType\RichText\RendererInterface
RichText field type renderer interface, to be implemented in MVC layer.
Definition: RendererInterface.php:15
eZ\Publish\Core\FieldType\RichText\Converter
Definition: FieldType/RichText/Converter/Aggregate.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.