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

getFieldData() public method

$field->value is a {@link eZ\Publish\SPI\Persistence\Content\FieldValue} object. This value holds the data as a {@link eZ\Publish\Core\FieldType\Value} based object, according to the field type (e.g. for TextLine, it will be a {@link eZ\Publish\Core\FieldType\TextLine\Value} object).
public getFieldData ( 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 getFieldData(VersionInfo $versionInfo, Field $field, array $context)
    {
        $id = $field->value->data['urlId'];
        if (empty($id)) {
            $field->value->externalData = null;
            return;
        }
        /** @var \eZ\Publish\Core\FieldType\Url\UrlStorage\Gateway $gateway */
        $gateway = $this->getGateway($context);
        $map = $gateway->getIdUrlMap(array($id));
        // URL id is not in the DB
        if (!isset($map[$id]) && isset($this->logger)) {
            $this->logger->error("URL with ID '{$id}' not found");
        }
        $field->value->externalData = isset($map[$id]) ? $map[$id] : '';
    }