You are here

public function AjaxCommandBase::getJSONText in Forena Reports 8

Same name and namespace in other branches
  1. 7.4 AjaxCommand/AjaxCommandBase.php \Drupal\forena\FrxPlugin\AjaxCommand\AjaxCommandBase::getJSONText()

Get json text.

Parameters

array $settings:

string $default_key: The key to look for if the text

3 calls to AjaxCommandBase::getJSONText()
Css::commandFromSettings in src/FrxPlugin/AjaxCommand/Css.php
CSS JQuery Command
Invoke::commandFromSettings in src/FrxPlugin/AjaxCommand/Invoke.php
Settings are passed into this factory from either the skin or the report element. If there are complex structures when used in the arguments they will be passed in the 'text' setting. These should be decoded by any plugin intending to use…
Settings::commandFromSettings in src/FrxPlugin/AjaxCommand/Settings.php
Settings are passed into this factory from either the skin or the report element. If there are complex structures when used in the arguments they will be passed in the 'text' setting. These should be decoded by any plugin intending to use…

File

src/FrxPlugin/AjaxCommand/AjaxCommandBase.php, line 42

Class

AjaxCommandBase

Namespace

Drupal\forena\FrxPlugin\AjaxCommand

Code

public function getJSONText(&$settings, $default_key = '') {
  $data = [];
  if ($default_key && isset($settings[$default_key])) {
    $data = $settings[$default_key];
    unset($settings[$default_key]);
  }
  if (!empty($settings['text'])) {
    $data = $settings['text'];
    unset($settings['text']);
  }
  if (!is_array($data) || !is_object($data)) {
    $data = @json_decode($data);
    if (!$data) {
      $data = [];
    }
  }
  static::replacer()
    ->replaceNested($data);
  return $data;
}