You are here

public static function RendererBase::addAttributes in Forena Reports 8

Helper function for convergint methods to a standard associated array.

Parameters

array $attributes:

string $key:

mixed $value:

1 call to RendererBase::addAttributes()
RendererBase::mergedAttributes in src/FrxPlugin/Renderer/RendererBase.php
Standard php array containing merged attributes Enter description here ...

File

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

Class

RendererBase
Crosstab Renderer

Namespace

Drupal\forena\FrxPlugin\Renderer

Code

public static function addAttributes(&$attributes, $key, $value) {
  $parts = explode('_', $key);
  $suff = '';
  if (count($parts) > 1) {
    $suff = array_pop($parts);
    $part = implode('_', $parts);
  }

  // If we have _0 _1 _2 attributes convert them into arrays.
  if ((int) $suff || $suff === '0') {
    $attributes[$part][] = (string) $value;
  }
  else {
    $attributes[$key] = (string) $value;
  }
}