eZ\Publish\Core\FieldType\FieldType::isEmptyValue PHP Method

isEmptyValue() public method

Default implementation, which performs a "==" check with the value returned by {@link getEmptyValue()}. Overwrite in the specific field type, if necessary.
public isEmptyValue ( eZ\Publish\SPI\FieldType\Value $value ) : boolean
$value eZ\Publish\SPI\FieldType\Value
return boolean
    public function isEmptyValue(SPIValue $value)
    {
        return $value === null || $value == $this->getEmptyValue();
    }

Usage Example

Beispiel #1
0
 /**
  * Returns if the given $value is considered empty by the field type.
  *
  * Usually, only the value returned by {@link getEmptyValue()} is
  * considered empty but that is not always the case.
  *
  * Note: This function assumes that $value is valid so this function can only
  * be used reliably on $values that came from the API, not from the user.
  *
  * @param mixed $value
  *
  * @return bool
  */
 public function isEmptyValue($value)
 {
     return $this->internalFieldType->isEmptyValue($value);
 }