Interface

eZ\Publish\SPI\FieldType\Nameable

interface Nameable

The field type interface which all field types have to implement to be able to generate content name when field is part of name-schema or url-schema.

For use by business logic (API implementation), so can not directly or indirectly rely on API.

Most FieldTypes will only need to use Value object in order to generate name, however others will for instance need to use other services. Psudo-example for a Content Relation FieldType: ```php class NameField implements Nameable { public function __construct(ContentHandler $contentHandler){...}

publish function getFieldName(Value $value, FieldDefinition $fieldDefinition, $languageCode)
{
    // This will only return main language but gives an example of use
    return $this->contentHandler->loadContentInfo($value->destinationContentId)->name;
}

} ```

Methods

string getFieldName(Value $value, FieldDefinition $fieldDefinition, string $languageCode)

Returns a human readable string representation from a given field.

Details

at line 53
public string getFieldName(Value $value, FieldDefinition $fieldDefinition, string $languageCode)

Returns a human readable string representation from a given field.

It will be used to generate content name and url alias if current field is designated to be used in the content name/urlAlias pattern.

The used $value can be assumed to be already accepted by {@link FieldType::acceptValue()}.

Parameters

Value $value
FieldDefinition $fieldDefinition
string $languageCode

Return Value

string