Form_Renderer - ensure params is an array
authorColeman Watts <coleman@civicrm.org>
Mon, 21 Jul 2014 08:39:48 +0000 (09:39 +0100)
committerColeman Watts <coleman@civicrm.org>
Mon, 21 Jul 2014 08:39:48 +0000 (09:39 +0100)
CRM/Core/Form/Renderer.php

index 58273ad6a07a2d154c4fd629a82b410591dd8e8f..3a75049e670669f0e3a52366e6bcadb791512948 100644 (file)
@@ -216,7 +216,9 @@ class CRM_Core_Form_Renderer extends HTML_QuickForm_Renderer_ArraySmarty {
     }
     if ($val) {
       $entity = $field->getAttribute('data-api-entity');
-      $params = json_decode($field->getAttribute('data-api-params'), TRUE);
+      // Get api params, ensure it is an array
+      $params = $field->getAttribute('data-api-params');
+      $params = $params ? json_decode($params, TRUE) : array();
       // Support serialized values
       if (strpos($val, CRM_Core_DAO::VALUE_SEPARATOR) !== FALSE) {
         $val = str_replace(CRM_Core_DAO::VALUE_SEPARATOR, ',', trim($val, CRM_Core_DAO::VALUE_SEPARATOR));