Convert to array if JSON isn't one already.

This commit is contained in:
Markus Birth 2016-07-09 20:40:46 +02:00
parent e024bdba85
commit 4df5b6896c

View File

@ -17,8 +17,11 @@ class FieldDefinition
throw new \Exception('File ' . $definitionFile . ' not found!');
}
$fieldDataJson = file_get_contents($definitionFile);
/** @var array */
$this->fieldData = json_decode($fieldDataJson, true);
$fieldData = json_decode($fieldDataJson, true);
if (!is_array($fieldData)) {
$fieldData = array($fieldData);
}
$this->fieldData = $fieldData;
}
public function getFieldData()