public function FrxSection::generate in Forena Reports 7.5
Build the template
Parameters
$xml:
$config:
Overrides RendererBase::generate
File
- src/
Renderer/ FrxSection.php, line 63
Class
Namespace
Drupal\forena\RendererCode
public function generate($xml, &$config) {
if (!isset($config['sections']) || !count($config['sections'])) {
$class = @$config['class'];
$frx = '';
if (!$class || $class == 'FrxMergeDocument') {
$frx = isset($config['foreach']) ? ' frx:foreach="' . $config['foreach'] . '"' : ' frx:foreach="*"';
}
$id = isset($config['id']) ? $config['id'] : 'section-1';
$id .= '-' . strtolower(str_replace('Frx', '', $class));
$o = "<div id='{$id}' class='{$class}'{$frx}>";
foreach (array(
'header',
'content',
'footer',
) as $content) {
if (isset($config[$content]['value']) && trim($config[$content]['value'])) {
$o .= $config[$content]['value'];
}
}
$o .= '</div>';
$config['sections'][$id] = array(
'id' => $id,
'markup' => $o,
'class' => $class,
'weight' => 1,
);
}
$config['class'] = get_class($this);
$div = $this
->blockDiv($config);
$this
->removeChildren($div);
if (isset($config['sections'])) {
foreach ($config['sections'] as $id => $section) {
$this
->addFragment($div, $section['markup']);
}
}
}