The output array will have the following layout:
array(
'bin' => array() // the binary id.
'value' => array() // the uuid.
'path' => array() // the path.
)
public static convertUuidsOrPathsToMetaModels ( array $values ) : array | ||
$values | array | The binary uuids or paths to convert. |
리턴 | array |
/** * Test all empty values are mapped correctly. * * See https://github.com/MetaModels/attribute_file/issues/45#issuecomment-85937268 * * @return void */ public function testConvertUuidsOrPathsToMetaModelsEmpty() { $emptyExpected = array('bin' => array(), 'value' => array(), 'path' => array()); $this->assertEquals($emptyExpected, ToolboxFile::convertUuidsOrPathsToMetaModels(null)); $this->assertEquals($emptyExpected, ToolboxFile::convertUuidsOrPathsToMetaModels(array())); $this->assertEquals($emptyExpected, ToolboxFile::convertUuidsOrPathsToMetaModels(array(null))); }
/** * {@inheritdoc} */ public function widgetToValue($varValue, $itemId) { return ToolboxFile::convertUuidsOrPathsToMetaModels((array) $varValue); }
/** * {@inheritDoc} */ public function getTranslatedDataFor($arrIds, $strLangCode) { $arrValues = parent::getTranslatedDataFor($arrIds, $strLangCode); foreach ($arrValues as $intId => $arrValue) { $arrValues[$intId]['value'] = ToolboxFile::convertUuidsOrPathsToMetaModels(deserialize($arrValue['value'], true)); } return $arrValues; }