eZ\Publish\Core\FieldType\Page\HashConverter::convertToValue PHP Method

convertToValue() public method

Converts the given $hash to a Value defined by the field type.
public convertToValue ( mixed $hash ) : Value
$hash mixed
return Value
    public function convertToValue($hash)
    {
        if (isset($hash['zones'])) {
            $zones = array();
            foreach ($hash['zones'] as $zone) {
                $zones[] = $this->convertZoneFromHash($zone);
            }
            $hash['zones'] = $zones;
        }
        return new Value(new Page($hash));
    }

Usage Example

Beispiel #1
0
 /**
  * Converts an $hash to the Value defined by the field type.
  *
  * @param mixed $hash
  *
  * @return \eZ\Publish\Core\FieldType\Page\Value
  */
 public function fromHash($hash)
 {
     if ($hash === null) {
         return $this->getEmptyValue();
     }
     return $this->hashConverter->convertToValue($hash);
 }