You are here

public function RendererBase::setFirstNode in Forena Reports 8

Sets the first child element to a node and returns it. IF the node

Parameters

DOMNode $node: Dom node on which to operate

string $tag: The tag to add

int $indent: How much space we need to indent the text by.

string $value: Contents of the new node

array attributes: html attributes to add

array : frx: attributes to add.

Return value

Node just set

File

src/FrxPlugin/Renderer/RendererBase.php, line 835
FrxRenderer.php Base class for FrxAPI custom Renderer @author davidmetzler

Class

RendererBase
Crosstab Renderer

Namespace

Drupal\forena\FrxPlugin\Renderer

Code

public function setFirstNode(DOMElement $parent_node, $indent = 0, $tag = 'div', $value = '', $attributes = array(), $frx_attributes = array()) {
  $dom = $this->report->dom;
  if (!$parent_node) {
    return NULL;
  }
  $nodes = $parent_node
    ->getElementsByTagName($tag);
  if ($nodes->length) {
    $node = $nodes
      ->item(0);
    $this
      ->setAttributes($node, $attributes, $frx_attributes);
  }
  else {
    $node = $this
      ->addNode($parent_node, $indent, $tag, $value, $attributes, $frx_attributes);
  }
  return $node;
}