You are here

public function RendererBase::validateTextFormats in Forena Reports 7.5

Helper funciton for validating text_format type controls.

Parameters

unknown $config:

unknown $elements:

Return value

multitype:Ambigous <The, string, A, Optional>

4 calls to RendererBase::validateTextFormats()
FrxCrosstab::configValidate in src/Renderer/FrxCrosstab.php
Default configuration validator. Simply validates header and footer attributes.
FrxEmailMerge::configValidate in src/Renderer/FrxEmailMerge.php
Default configuration validator. Simply validates header and footer attributes.
FrxMergeDocument::configValidate in src/Renderer/FrxMergeDocument.php
Default configuration validator. Simply validates header and footer attributes.
RendererBase::configValidate in src/Renderer/RendererBase.php
Default configuration validator. Simply validates header and footer attributes.

File

src/Renderer/RendererBase.php, line 566
FrxRenderer.php Base class for Frx custom Renderer @author davidmetzler

Class

RendererBase

Namespace

Drupal\forena\Renderer

Code

public function validateTextFormats(&$config, $elements) {
  $temp_dom = Frx::tempDOM();
  $errors = array();
  foreach ($elements as $element) {
    if (isset($config[$element]['value'])) {
      if ($config[$element]['value']) {
        $body_xml = '<?xml version="1.0" encoding="UTF-8"?>
           <!DOCTYPE root [
           <!ENTITY nbsp "&#160;">
           ]><html xmlns:frx="' . $this->xmlns . '"><body>' . $config[$element]['value'] . '</body></html>';
        @$temp_dom
          ->loadXML($body_xml);
        if (!$temp_dom->documentElement) {
          $errors[$element] = t('Invalid XHTML in %s', array(
            '%s' => $element,
          ));
        }
      }
    }
  }
  return $errors;
}