Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
eZ\Publish\Core\Repository\Helper\NameSchemaService Class Reference

NameSchemaService is internal service for resolving content name and url alias patterns. More...

## Public Member Functions
| __construct (ContentTypeHandler $contentTypeHandler, ContentTypeDomainMapper $contentTypeDomainMapper, NameableFieldTypeRegistry $nameableFieldTypeRegistry, array $settings=[])
| Constructs a object to resolve $nameSchema with $contentVersion fields values. More...
| resolveUrlAliasSchema (Content $content, ContentType $contentType=null)
| Convenience method for resolving URL alias schema. More...
| resolveNameSchema (Content $content, array $fieldMap=[], array $languageCodes=[], ContentType $contentType=null)
| Convenience method for resolving name schema. More...
| resolve ($nameSchema, $contentType, array $fieldMap, array $languageCodes)
| Returns the real name for a content name pattern. More...

## Public Attributes
const | META_STRING = 'EZMETAGROUP_'

## Protected Member Functions
| mergeFieldMap (Content $content, array $fieldMap, array $languageCodes)
| Convenience method for resolving name schema. More...
| getFieldTitles (array $schemaIdentifiers, $contentType, array $fieldMap, $languageCode)
| Fetches the list of available Field identifiers in the token and returns an array of their current title value. More...
| extractTokens ($nameSchema)
| Extract all tokens from $namePattern. More...
| resolveToken ($token, $titles, $groupLookupTable)
| Looks up the value $token should be replaced with and returns this as a string. More...
| isTokenGroup ($identifier)
| Checks whether $identifier is a placeholder for a token group. More...
| tokenParts ($token)
| Returns the different constituents of $token in an array. More...
| filterNameSchema ($nameSchema)
| Builds a lookup / translation table for groups in the $namePattern. More...
| getIdentifiers ($schemaString)
| Returns all identifiers from all tokens in the name schema. More...

## Protected Attributes
| $contentTypeHandler
| $contentTypeDomainMapper
| $nameableFieldTypeRegistry
| $settings

## Detailed Description

NameSchemaService is internal service for resolving content name and url alias patterns.

This code supports content name pattern groups.

Syntax: `<attribute_identifier> <attribute_identifier> <2nd-identifier> User text <attribute_identifier>|(<2nd-identifier><3rd-identifier>)`

Example: `<nickname|(<firstname> <lastname>)>`

Tokens are looked up from left to right. If a match is found for the leftmost token, the 2nd token will not be used. Tokens are representations of fields. So a match means that that the current field has data.

Tokens are the field definition identifiers which are used in the class edit-interface.

Meant for internal use by Repository.

Definition at line 39 of file NameSchemaService.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZ\Publish\Core\Repository\Helper\NameSchemaService::__construct | ( | ContentTypeHandler | $contentTypeHandler,
|  | ContentTypeDomainMapper | $contentTypeDomainMapper,
|  | NameableFieldTypeRegistry | $nameableFieldTypeRegistry,
|  | array | $settings = `[]`
| ) |  |

Constructs a object to resolve $nameSchema with $contentVersion fields values.

Parameters

  \eZ\Publish\SPI\Persistence\Content\Type\Handler | $contentTypeHandler |
  ContentTypeDomainMapper | $contentTypeDomainMapper |
  NameableFieldTypeRegistry | $nameableFieldTypeRegistry |
  array | $settings |

Definition at line 68 of file NameSchemaService.php.

References eZ\Publish\Core\Repository\Helper\NameSchemaService\$contentTypeDomainMapper, eZ\Publish\Core\Repository\Helper\NameSchemaService\$contentTypeHandler, eZ\Publish\Core\Repository\Helper\NameSchemaService\$nameableFieldTypeRegistry, and eZ\Publish\Core\Repository\Helper\NameSchemaService\$settings.

## Member Function Documentation

## ◆ extractTokens()

eZ\Publish\Core\Repository\Helper\NameSchemaService::extractTokens | ( |  | $nameSchema | ) |
| protected

Extract all tokens from $namePattern.

Example: `Text <token> more text ==> <token>`

Parameters

  string | $nameSchema |

Returns
  array

Definition at line 275 of file NameSchemaService.php.

Referenced by eZ\Publish\Core\Repository\Helper\NameSchemaService\resolve(), and eZ\Publish\Core\Repository\Helper\NameSchemaService\resolveToken().

## ◆ filterNameSchema()

eZ\Publish\Core\Repository\Helper\NameSchemaService::filterNameSchema | ( |  | $nameSchema | ) |
| protected

Builds a lookup / translation table for groups in the $namePattern.

The groups are referenced with a generated meta-token in the original name pattern.

Returns intermediate name pattern where groups are replaced with meta- tokens.

Parameters

  string | $nameSchema |

Returns
  string

Definition at line 383 of file NameSchemaService.php.

Referenced by eZ\Publish\Core\Repository\Helper\NameSchemaService\resolve().

## ◆ getFieldTitles()

eZ\Publish\Core\Repository\Helper\NameSchemaService::getFieldTitles | ( | array | $schemaIdentifiers,
|  |  | $contentType,
|  | array | $fieldMap,
|  |  | $languageCode
| ) |  |
| protected

Fetches the list of available Field identifiers in the token and returns an array of their current title value.

See also
  \eZ\Publish\Core\Repository\FieldTypegetName()

Parameters

  string[] | $schemaIdentifiers |
  \eZ\Publish\SPI\Persistence\Content\Type | \eZ\Publish\API\Repository\Values\ContentType\ContentType | $contentType |
  array | $fieldMap |
  string | $languageCode |

Exceptions

Definition at line 219 of file NameSchemaService.php.

Referenced by eZ\Publish\Core\Repository\Helper\NameSchemaService\resolve().

## ◆ getIdentifiers()

eZ\Publish\Core\Repository\Helper\NameSchemaService::getIdentifiers | ( |  | $schemaString | ) |
| protected

Returns all identifiers from all tokens in the name schema.

Parameters

  string | $schemaString |

Returns
  array

Definition at line 417 of file NameSchemaService.php.

Referenced by eZ\Publish\Core\Repository\Helper\NameSchemaService\resolve().

## ◆ isTokenGroup()

eZ\Publish\Core\Repository\Helper\NameSchemaService::isTokenGroup | ( |  | $identifier | ) |
| protected

Checks whether $identifier is a placeholder for a token group.

Parameters

  string | $identifier |

Returns
  bool

Definition at line 343 of file NameSchemaService.php.

Referenced by eZ\Publish\Core\Repository\Helper\NameSchemaService\resolveToken().

## ◆ mergeFieldMap()

eZ\Publish\Core\Repository\Helper\NameSchemaService::mergeFieldMap | ( | Content | $content,
|  | array | $fieldMap,
|  | array | $languageCodes
| ) |  |
| protected

Convenience method for resolving name schema.

Parameters

  \eZ\Publish\API\Repository\Values\Content\Content | $content |
  array | $fieldMap |
  array | $languageCodes |

Returns
  array

Definition at line 145 of file NameSchemaService.php.

## ◆ resolve()

eZ\Publish\Core\Repository\Helper\NameSchemaService::resolve | ( |  | $nameSchema,
|  |  | $contentType,
|  | array | $fieldMap,
|  | array | $languageCodes
| ) |  |

Returns the real name for a content name pattern.

Parameters

  string | $nameSchema |
  \eZ\Publish\SPI\Persistence\Content\Type | \eZ\Publish\API\Repository\Values\ContentType\ContentType | $contentType |
  array | $fieldMap |
  array | $languageCodes |

Returns
  string[]

Definition at line 174 of file NameSchemaService.php.

References eZ\Publish\Core\Repository\Helper\NameSchemaService\extractTokens(), eZ\Publish\Core\Repository\Helper\NameSchemaService\filterNameSchema(), eZ\Publish\Core\Repository\Helper\NameSchemaService\getFieldTitles(), eZ\Publish\Core\Repository\Helper\NameSchemaService\getIdentifiers(), and eZ\Publish\Core\Repository\Helper\NameSchemaService\resolveToken().

Referenced by eZ\Publish\Core\Repository\Helper\NameSchemaService\resolveNameSchema(), and eZ\Publish\Core\Repository\Helper\NameSchemaService\resolveUrlAliasSchema().

## ◆ resolveNameSchema()

eZ\Publish\Core\Repository\Helper\NameSchemaService::resolveNameSchema | ( | Content | $content,
|  | array | $fieldMap = `[]`,
|  | array | $languageCodes = `[]`,
|  | ContentType | $contentType = `null`
| ) |  |

Convenience method for resolving name schema.

Parameters

  \eZ\Publish\API\Repository\Values\Content\Content | $content |
  array | $fieldMap |
  array | $languageCodes |
  \eZ\Publish\API\Repository\Values\ContentType\ContentType | null | $contentType |

Returns
  array

Definition at line 116 of file NameSchemaService.php.

References eZ\Publish\Core\Repository\Helper\NameSchemaService\resolve().

## ◆ resolveToken()

eZ\Publish\Core\Repository\Helper\NameSchemaService::resolveToken | ( |  | $token,
|  |  | $titles,
|  |  | $groupLookupTable
| ) |  |
| protected

Looks up the value $token should be replaced with and returns this as a string.

Meta strings denoting token groups are automatically inferred.

Parameters

  string | $token |
  array | $titles |
  array | $groupLookupTable |

Returns
  string

Definition at line 297 of file NameSchemaService.php.

References eZ\Publish\Core\Repository\Helper\NameSchemaService\extractTokens(), eZ\Publish\Core\Repository\Helper\NameSchemaService\isTokenGroup(), and eZ\Publish\Core\Repository\Helper\NameSchemaService\tokenParts().

Referenced by eZ\Publish\Core\Repository\Helper\NameSchemaService\resolve().

## ◆ resolveUrlAliasSchema()

eZ\Publish\Core\Repository\Helper\NameSchemaService::resolveUrlAliasSchema | ( | Content | $content,
|  | ContentType | $contentType = `null`
| ) |  |

Convenience method for resolving URL alias schema.

Parameters

  \eZ\Publish\API\Repository\Values\Content\Content | $content |
  \eZ\Publish\API\Repository\Values\ContentType\ContentType | null | $contentType |

Returns
  array

Definition at line 92 of file NameSchemaService.php.

References eZ\Publish\Core\Repository\Helper\NameSchemaService\resolve().

## ◆ tokenParts()

eZ\Publish\Core\Repository\Helper\NameSchemaService::tokenParts | ( |  | $token | ) |
| protected

Returns the different constituents of $token in an array.

The normal case here is that the different identifiers within one token will be tokenized and returned.

Example: `"&lt;title|text&gt;" ==> array( 'title', 'text' )`

Parameters

  string | $token |

Returns
  array

Definition at line 366 of file NameSchemaService.php.

Referenced by eZ\Publish\Core\Repository\Helper\NameSchemaService\resolveToken().

## Member Data Documentation

## ◆ $contentTypeDomainMapper

eZ\Publish\Core\Repository\Helper\NameSchemaService::$contentTypeDomainMapper
| protected

Definition at line 52 of file NameSchemaService.php.

Referenced by eZ\Publish\Core\Repository\Helper\NameSchemaService\__construct().

## ◆ $contentTypeHandler

eZ\Publish\Core\Repository\Helper\NameSchemaService::$contentTypeHandler
| protected

Definition at line 49 of file NameSchemaService.php.

Referenced by eZ\Publish\Core\Repository\Helper\NameSchemaService\__construct().

## ◆ $nameableFieldTypeRegistry

eZ\Publish\Core\Repository\Helper\NameSchemaService::$nameableFieldTypeRegistry
| protected

Definition at line 55 of file NameSchemaService.php.

Referenced by eZ\Publish\Core\Repository\Helper\NameSchemaService\__construct().

## ◆ $settings

eZ\Publish\Core\Repository\Helper\NameSchemaService::$settings
| protected

Definition at line 58 of file NameSchemaService.php.

Referenced by eZ\Publish\Core\Repository\Helper\NameSchemaService\__construct().

## ◆ META_STRING

const eZ\Publish\Core\Repository\Helper\NameSchemaService::META_STRING = 'EZMETAGROUP_'

Definition at line 46 of file NameSchemaService.php.

The documentation for this class was generated from the following file:

- NameSchemaService.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.