parseValue() public method

The returned array at least transports an string in the key 'text' which SHOULD be useful when being echo'ed in a template and the raw value in the section 'raw'. Each attribute class MAY return as many other values in this array with custom keys as it wants.
public parseValue ( array $arrRowData, string $strOutputFormat = 'text', MetaModels\Render\Setting\ISimple | null $objSettings = null ) : array
$arrRowData array The (native) row data from the MetaModel table.
$strOutputFormat string The desired output format.
$objSettings MetaModels\Render\Setting\ISimple | null Custom settings to be passed to the renderer.
return array An array with all the converted data.
Beispiel #1
0
 /**
  * Helper function for {@see MetaModelItem::parseValue()} and {@see MetaModelItem::parseAttribute()}.
  *
  * @param IAttribute       $objAttribute    The attribute to parse.
  *
  * @param string           $strOutputFormat The desired output format.
  *
  * @param ICollection|null $objSettings     The settings object to be applied.
  *
  * @return array The parsed information for the given attribute.
  */
 public function internalParseAttribute($objAttribute, $strOutputFormat, $objSettings)
 {
     $arrResult = array();
     if ($objAttribute) {
         // Extract view settings for this attribute.
         if ($objSettings) {
             $objAttributeSettings = $objSettings->getSetting($objAttribute->getColName());
         } else {
             $objAttributeSettings = null;
         }
         foreach ($objAttribute->parseValue($this->arrData, $strOutputFormat, $objAttributeSettings) as $strKey => $varValue) {
             $arrResult[$strKey] = $varValue;
         }
     }
     // If "hideEmptyValues" is true and the raw is empty remove text and output format.
     if ($objSettings instanceof ICollection && $objSettings->get('hideEmptyValues') && $this->isEmptyValue($arrResult['raw'])) {
         unset($arrResult[$strOutputFormat]);
         unset($arrResult['text']);
     }
     return $arrResult;
 }