@param BBcodeElementNodeInterface $el
@param bool                       $preview

@return string
559082
protected function generateHtml(BBcodeElementNodeInterface $el, $preview = false)
    {
        $children = $el->getChildren();
        $option = $el->getAttribute();
        if ($preview) {
            return $this->templating->render(
                'OpenOrchestraDisplayBundle::BBcode/link.html.twig',
                array(
                    'href' => '#',
                    'options' => html_entity_decode($option['link']),
                    'text' => $children[0]->getAsBBCode(),
                )
            );
        }
        $parameters = json_decode(html_entity_decode($option['link']), true);
        $uri = '#';
        try {
            $linkName = $this->nodeManager->getRouteDocumentName($parameters);
            try {
                $routeCompileParameters = array();
                if (array_key_exists('wildcard', $parameters)) {
                    foreach ($parameters['wildcard'] as $name => $value) {
                        $routeCompileParameters[$name] = urlencode($value);
                    }
                }
                $uri = $this->urlGenerator->generate($linkName, $routeCompileParameters, UrlGeneratorInterface::ABSOLUTE_PATH).(array_key_exists('query', $parameters) ? $parameters['query'] : '');
            } catch(RouteNotFoundException $e) {
            }
        } catch (NodeNotFoundException $e) {
        }

        return $this->templating->render(
            'OpenOrchestraDisplayBundle::BBcode/link.html.twig',
            array(
                'href' => $uri,
                'options' => '',
                'text' => $children[0]->getAsBBCode(),
            )
        );
    }
1173647
public function getElement(\DOMElement $nodeList, $level = 0, $showPaths = false)
    {
        $tabs = str_repeat("\t", $level);
        $output = '';
        if (!$showPaths) {
            $output = "";
            foreach ($nodeList as $attribute) {
                $output .= $tabs . $attribute->nodeName . " = " . $attribute->nodeValue . "\n";
            }

            $output .= $tabs . $nodeList->nodeName . " = " . $nodeList->nodeValue . "\n";
        } else {
            $output .= $nodeList->getNodePath() . "\n";
        }

        foreach ($nodeList->childNodes as $childObject) {
            if ($childObject instanceof \DOMElement) {
                $output .= $this->getElement($childObject, $level + 1, $showPaths);
            } elseif ($showPaths) {
                $output .= $childObject->getNodePath() . "\n";
            }
        }

        return $output;
    }
1329363
public function render(ElementInterface $element)
    {
        $captcha = $element->getCaptcha();

        if ($captcha === null || !$captcha instanceof CaptchaAdapter) {
            throw new Exception\DomainException(sprintf(
                '%s requires that the element has a "captcha" attribute implementing Zend\Captcha\AdapterInterface',
                __METHOD__
            ));
        }

        $name = $element->getName();
        $id = $element->getAttribute('id') ? $element->getAttribute('id') : $name;

        $captchaPattern = '<div %s></div>';

        $captchaAttributes = $this->createAttributesString(array(
            'class' => 'g-recaptcha '.$element->getAttribute('class'),
            'data-sitekey' => $captcha->getSiteKey(),
            'data-theme' => $captcha->getTheme(),
            'data-type' => $captcha->getType(),
            'data-size' => $captcha->getSize(),
            'data-callback' => $captcha->getCallback(),
        ));


        $captchaElement = sprintf($captchaPattern, $captchaAttributes);
        $input = $this->renderHiddenInput($id, $name);
        $js = $this->renderJsCallback($captcha->getCallback(), $id);

        return $captchaElement . $input . $js;
    }
112364
protected static function evaluate($query, DOMElement $element)
	{
		$xpath = new DOMXPath($element->ownerDocument);

		return $xpath->evaluate('boolean(' . $query . ')', $element);
	}
349435
public function render(ElementInterface $element)
    {
        $captcha = $element->getCaptcha();

        if ($captcha === null || !$captcha instanceof CaptchaAdapter) {
            throw new Exception\DomainException(sprintf(
                '%s requires that the element has a "captcha" attribute of type Zend\Captcha\Image; none found',
                __METHOD__
            ));
        }

        $captcha->generate();

        $imgAttributes = array(
            'width'  => $captcha->getWidth(),
            'height' => $captcha->getHeight(),
            'alt'    => $captcha->getImgAlt(),
            'src'    => $captcha->getImgUrl() . $captcha->getId() . $captcha->getSuffix(),
        );

        if ($element->hasAttribute('id')) {
            $imgAttributes['id'] = $element->getAttribute('id') . '-image';
        }

        $closingBracket = $this->getInlineClosingBracket();
        $img = sprintf(
            '<img %s%s',
            $this->createAttributesString($imgAttributes),
            $closingBracket
        );

        $position     = $this->getCaptchaPosition();
        $separator    = $this->getSeparator();
        $captchaInput = $this->renderCaptchaInputs($element);

        $pattern = '<div style="float:left;" class="form-captcha-image">%s%s</div><div class="form-captcha-input" style="margin-left:' . $imgAttributes['width'] . 'px">%s</div>';
        if ($position == self::CAPTCHA_PREPEND) {
            return sprintf($pattern, $captchaInput, $separator, $img);
        }
        return sprintf($pattern, $img, $separator, $captchaInput);
    }
223302
public static function innerXML(DOMElement $element)
	{
		// Serialize the XML then remove the outer element
		$xml = $element->ownerDocument->saveXML($element);
		$pos = 1 + strpos($xml, '>');
		$len = strrpos($xml, '<') - $pos;

		// If the template is empty, return an empty string
		return ($len < 1) ? '' : substr($xml, $pos, $len);
	}
803534
private function checkPublishSlaves(ElementVersion $elementVersion, TreeNodeInterface $node, Teaser $teaser = null, $language)
    {
        $publishSlaves = ['elements' => [], 'languages' => []];

        if ($elementVersion->getElement()->getMasterLanguage() !== $language) {
            return $publishSlaves;
        }

        foreach ($this->availableLanguages as $slaveLanguage) {
            if ($language === $slaveLanguage) {
                continue;
            }

            if ($teaser) {
                if ($this->teaserManager->isPublished($teaser, $slaveLanguage)) {
                    if (!$this->teaserManager->isAsync($teaser, $slaveLanguage)) {
                        $publishSlaves['languages'][] = $slaveLanguage;
                    } else {
                        $publishSlaves['elements'][] = [$teaser->getId(), $slaveLanguage, $elementVersion->getVersion(), 'async', 1];
                    }
                }
                // TODO: needed?
                /*
                } else {
                    if ($this->container->getParameter(
                        'phlexible_element.publish.cross_language_publish_offline'
                    )
                    ) {
                        $publishSlaves[] = array($teaser->getId(), $slaveLanguage, 0, '', 0);
                    }
                */
            } else {
                if ($node->getTree()->isPublished($node, $slaveLanguage)) {
                    if (!$node->getTree()->isAsync($node, $slaveLanguage)) {
                        $publishSlaves['languages'][] = $slaveLanguage;
                    } else {
                        $publishSlaves['elements'][] = [$node->getId(), $slaveLanguage, $elementVersion->getVersion(), 'async', 1];
                    }
                }
                // TODO: needed?
                /*
                } else {
                    if ($this->container->getParameter('phlexible_element.publish.cross_language_publish_offline')) {
                        $publishSlaves[] = array($node->getId(), $slaveLanguage, $newVersion, '', 0);
                    }
                */
            }
        }

        return $publishSlaves;
    }
128256
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
    {
        $block = $this->getLayout()->createBlock(
            \Dotdigitalgroup\Email\Block\Adminhtml\Config\Configuration\Preview::class,
            'ddg_automation_dynamic_preview'
        )->setTemplate(
            'system/preview.phtml'
        );
        $this->setElement($element);
        $header = $this->_getHeaderHtml($element);

        $elements = '';
        foreach ($element->getElements() as $field) {
            if ($field instanceof \Magento\Framework\Data\Form\Element\Fieldset) {
                $elements .= '<tr id="row_' . $field->getHtmlId() . '">'
                    . '<td colspan="4">' . $field->toHtml() . '</td></tr>';
            } else {
                $elements .= $field->toHtml();
            }
        }

        $footer = $this->_getFooterHtml($element);

        return $header . $block->_toHtml() . $elements . $footer;
    }
630959
def element_preview_code(element)
      if respond_to?(:tag_options)
        tag_options(element_preview_code_attributes(element))
      else
        # Rails 5.1 uses TagBuilder
        tag_builder.tag_options(element_preview_code_attributes(element))
      end
    end
873337
function(string, $el) {
            var img = $el.find('img');
            var matchStart = $el.text().toLowerCase().indexOf("" + string.toLowerCase() + ""),
                matchEnd = matchStart + string.length - 1,
                beforeMatch = $el.text().slice(0, matchStart),
                matchText = $el.text().slice(matchStart, matchEnd + 1),
                afterMatch = $el.text().slice(matchEnd + 1);
            $el.html("<span>" + beforeMatch + "<span class='highlight'>" + matchText + "</span>" + afterMatch + "</span>");
            if (img.length) {
              $el.prepend(img);
            }
          }
1140831
protected function renderType(ElementInterface $element)
    {
        $type = $element->getAttribute('type');

        if (isset($this->typeMap[$type])) {
            return $this->renderHelper($this->typeMap[$type], $element);
        }
        return null;
    }
429878
public function renderElement(Element $element) : string
    {
        // @todo - if the element implements neither HasContent or HasChildren, make it self-closing <img />
        // @todo - fix indentation - currently it adds an extra line as the middle indentation
        return $this->indent($this->depth, sprintf('<%s%s>', $element->getElement(), $this->getAttributesForElement($element))) .
            $this->indent($this->depth++, $this->getContentForElement($element)) .
            $this->indent(--$this->depth, sprintf('</%s>', $element->getElement()));
    }
69839
public function renderElement(\HTML_QuickForm2_Node $element) {
        $ary = $this->buildCommonFields($element) + [
                'html'              => $element->__toString(),
                'value'             => $element->getValue(),
                'type'              => $element->getType(),
                'label'             => $element->getLabel(),
                'desc'              => $element->getDesc(),
                'example'           => $element->getExample(),
                'placeholder'       => $element->getPlaceholder(),
                'example_is_append' => $element->getExampleIsAppend(),
                'prepend'           => $element->getPrepend(),
                'append'            => $element->getAppend(),
                'tpl'               => $element->getTpl(),
                'required'          => $element->isRequired(),
                'is_inline'         => $element->getIsInline(),
                'wrap_class'        => $element->getWrapClass(),
                'checked'           => $element->getAttribute('checked'),
            ];
        $this->pushScalar($ary);
    }
91940
public function render(ElementInterface $element): string
    {
        if (! $element instanceof FormInterface) {
            throw new InvalidClassException(
                sprintf(
                    'The given element "%s" has to implement "%s"',
                    $element->name(),
                    FormInterface::class
                )
            );
        }

        $row = $this->factory->create(FormRow::class);

        $html = array_reduce(
            $element->elements(),
            function ($html, ElementInterface $next) use ($element, $row) {
                $html .= $row->render($next);

                return $html;
            },
            ''
        );

        $errors = $element instanceof ErrorAwareInterface
            ? $this->factory->create(Errors::class)
                ->render($element)
            : '';

        $class = $errors !== ''
            ? 'form-table--has-errors'
            : '';

        $html = sprintf('%1$s <table class="form-table %2$s">%3$s</table>', $errors, $class, $html);

        return sprintf(
            '<form %s>%s</form>',
            $this->attributesToString($element->attributes()),
            $html
        );
    }
1083946
public function createPreviewHtmlElement($label = false) {
        if ($label) {
            $options['label'] = $this->translate->_($label);
        } else {
            $options['label'] = $this->translate->_('Preview HTML');
        }
        $options['nohidden'] = true;

        return $this->_form->createElement('Html', 'preview_html', $options);
    }
147065
protected function getFormat(BBcodeElementNodeInterface $el)
    {
        $options = $el->getAttribute();
        $options = json_decode($options['media'], true);

        return is_array($options) && array_key_exists('format', $options) ? $options['format'] : MediaInterface::MEDIA_ORIGINAL;
    }
153255
public function __toHtml($submitted = false, $blnSimpleLayout = false, $blnLabel = true, $blnDisplayErrors = true, $intCount = 0)
    {
        $strName = ($intCount == 0) ? $this->__name : $this->__name . "_" . $intCount;
        $strId = ($intCount == 0) ? $this->__id : $this->__id . "_" . $intCount;

        $blnError = ($submitted && ! $this->__validator->validate($intCount) && $blnDisplayErrors) ? true : false;

        if (! $blnSimpleLayout) {
            // *** We asume that all dynamic fields greater than 0 are never required.
            if ($this->__validator->getRequired() && $intCount == 0) {
                $this->setMeta("class", "vf__required");
            } else {
                $this->setMeta("class", "vf__optional");
            }

            // *** Set custom meta.
            if ($blnError) {
                $this->setMeta("class", "vf__error");
            }

            if (! $blnLabel) {
                $this->setMeta("class", "vf__nolabel");
            }

                // Call this right before __getMetaString();
            $this->setConditionalMeta();

            $strOutput = "<div{$this->__getMetaString()}>\n";

            if ($blnError) {
                $strOutput .= "<p class=\"vf__error\">{$this->__validator->getError($intCount)}</p>";
            }

            if ($blnLabel) {
                $strLabel = (! empty($this->__requiredstyle) && $this->__validator->getRequired()) ? sprintf($this->__requiredstyle, $this->__label) : $this->__label;
                if (! empty($this->__label)) {
                    $strOutput .= "<label for=\"{$strId}\"{$this->__getLabelMetaString()}>{$strLabel}</label>\n";
                }
            }
        } else {
            if ($blnError) {
                $this->setMeta("class", "vf__error");
            }

            $this->setMeta("class", "vf__multifielditem");

            // Call this right before __getMetaString();
            $this->setConditionalMeta();

            $strOutput = "<div{$this->__getMetaString()}\">\n";
        }

        // *** Fixing an unusual uploading bug.
        $intMaxFileSize = $this->convertToBytes(ini_get("upload_max_filesize"));
        $strOutput .= "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"{$intMaxFileSize}\" />";

        $arrValues = [];
        $strValue = $this->__getValue($submitted, $intCount);
        if (!is_array($strValue)) {
            $strValue = htmlspecialchars($strValue, ENT_QUOTES);
            if (!empty($strValue)) {
                $arrValues = [$strValue];
            }
        } else {
            foreach ($strValue as $value) {
                $value = htmlspecialchars($value, ENT_QUOTES);
                $arrValues[] = $value;
            }
        }
        
        //*** Render the file input. We don't set a value for it.
        $strOutput .= "<input type=\"file\" name=\"{$strName}[]\" id=\"{$strId}\"{$this->__getFieldMetaString()} />\n";
        
        //*** Render sanitized values as hidden inputs.
        $intCount = 1;
        foreach ($arrValues as $strValue) {
            $strOutput .= "<input type=\"hidden\" name=\"{$strName}[]\" id=\"{$strId}-{$intCount}\" value=\"{$strValue}\" />\n";
        
            $intCount++;
        }
        
        if (! empty($this->__tip)) {
            $strOutput .= "<small class=\"vf__tip\"{$this->__getTipMetaString()}>{$this->__tip}</small>\n";
        }

        $strOutput .= "</div>\n";

        return $strOutput;
    }