eZ\Publish\Core\FieldType\Image\Type::createValueFromInput PHP Method

createValueFromInput() protected method

Inspects given $inputValue and potentially converts it into a dedicated value object.
protected createValueFromInput ( string | array | Value $inputValue ) : Value
$inputValue string | array | Value
return Value The potentially converted and structurally plausible value.
    protected function createValueFromInput($inputValue)
    {
        if (is_string($inputValue)) {
            $inputValue = Value::fromString($inputValue);
        }
        if (is_array($inputValue)) {
            if (isset($inputValue['inputUri']) && file_exists($inputValue['inputUri'])) {
                $inputValue['fileSize'] = filesize($inputValue['inputUri']);
                if (!isset($inputValue['fileName'])) {
                    $inputValue['fileName'] = basename($inputValue['inputUri']);
                }
            }
            $inputValue = new Value($inputValue);
        }
        return $inputValue;
    }