eZ\Publish\Core\FieldType\Url\UrlStorage::storeFieldData PHP Method

storeFieldData() public method

See also: eZ\Publish\SPI\FieldType\FieldStorage
public storeFieldData ( eZ\Publish\SPI\Persistence\Content\VersionInfo $versionInfo, eZ\Publish\SPI\Persistence\Content\Field $field, array $context )
$versionInfo eZ\Publish\SPI\Persistence\Content\VersionInfo
$field eZ\Publish\SPI\Persistence\Content\Field
$context array
    public function storeFieldData(VersionInfo $versionInfo, Field $field, array $context)
    {
        /** @var \eZ\Publish\Core\FieldType\Url\UrlStorage\Gateway $gateway */
        $gateway = $this->getGateway($context);
        $url = $field->value->externalData;
        if (empty($url)) {
            return false;
        }
        $map = $gateway->getUrlIdMap(array($url));
        if (isset($map[$url])) {
            $urlId = $map[$url];
        } else {
            $urlId = $gateway->insertUrl($url);
        }
        $gateway->linkUrl($urlId, $field->id, $versionInfo->versionNo);
        $field->value->data['urlId'] = $urlId;
        // Signals that the Value has been modified and that an update is to be performed
        return true;
    }