You are here

public function RendererBase::blockDiv in Forena Reports 8

Generate generic div tag.

Parameters

array $config:

string $text:

1 call to RendererBase::blockDiv()
RendererBase::generate in src/FrxPlugin/Renderer/RendererBase.php
Generate the template from the configuration.

File

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

Class

RendererBase
Crosstab Renderer

Namespace

Drupal\forena\FrxPlugin\Renderer

Code

public function blockDiv(&$config, $text = '') {
  $node = $this->reportDocDomNode;
  $heading = $this
    ->extract('heading', $config);
  $descr = $this
    ->extract('description', $config);
  $include = $this
    ->extract('include', $config);
  $block = $this
    ->extract('block', $config);
  $foreach = $this
    ->extract('foreach', $config);
  $id = $this
    ->extract('id', $config);
  if (!$id) {
    $id = $this
      ->idFromBlock($block);
  }
  $class = $this
    ->extract('class', $config);
  if (!$class) {
    $class = get_class($this);
  }
  $frx_attributes = array(
    'block' => $block,
  );
  if ($foreach) {
    $frx_attributes['foreach'] = $foreach;
  }
  $attributes = array(
    'id' => $id,
    'class' => $class,
  );
  $this
    ->setAttributes($node, $attributes, $frx_attributes);
  if ($heading) {
    $this
      ->addNode($node, 4, 'h2', $heading);
  }
  if ($descr) {
    $this
      ->addNode($node, 4, 'p', $descr);
  }
  if ($include) {
    $src = 'reports/' . str_replace('/', '.', $include);
    $this
      ->addNode($node, 4, 'div', NULL, NULL, array(
      'renderer' => get_class($this),
      'src' => $src,
    ));
  }
  return $node;
}