Skip to content

Commit

Permalink
Handle corner case of JSON data being stored in a textarea in a repea…
Browse files Browse the repository at this point in the history
…t group.
  • Loading branch information
cheesegrits committed May 27, 2019
1 parent d201ee1 commit 61e4716
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions plugins/fabrik_element/textarea/textarea.php
Expand Up @@ -270,6 +270,17 @@ public function render($data, $repeatCounter = 0)
$cols = $params->get('width', $element->width);
$rows = $params->get('height', $element->height);
$value = $this->getValue($data, $repeatCounter);

/**
* edge case where they are storing JSON in a repeat group, and setJoinData() in form model will have
* run the value through JSONtoData(). So if the value is an object or array, JSON encode it.
*/

if (is_array($value) || is_object($value))
{
$value = json_encode($value);
}

$bits = array();
$bits['class'] = "fabrikinput inputbox " . $params->get('bootstrap_class');
$wysiwyg = $this->useWysiwyg();
Expand Down

0 comments on commit 61e4716

Please sign in to comment.