eZ\Publish\Core\FieldType\Page\Type::getEmptyValue PHP Method

getEmptyValue() public method

This value will be used, if no value was provided for a field of this type and no default value was specified in the field definition.
public getEmptyValue ( ) : mixed
return mixed
    public function getEmptyValue()
    {
        return new Value();
    }

Usage Example

Example #1
0
 /**
  * Creates a value object to use as the field value when setting an ez page field type.
  *
  * @param array $fieldValueArray The definition of teh field value, structured in the yml file
  * @param array $context The context for execution of the current migrations. Contains f.e. the path to the migration
  * @return PageValue
  */
 public function createValue($fieldValueArray, array $context = array())
 {
     $layout = $fieldValueArray['layout'];
     $hashConverter = new HashConverter();
     $pageType = new PageType($this->pageService, $hashConverter);
     /** @var PageValue $pageValue */
     $pageValue = $pageType->getEmptyValue();
     $pageValue->page = new Page(array('zones' => array(), 'zonesById' => array(), 'layout' => $layout));
     return $pageValue;
 }