Skip to content

Title Pattern

Definition

The title pattern is a user-configurable template that is used to build the title for an Entity. title patterns are defined for all Entities in a Bundle and can consist of multiple constituents that can be either:

  • Paths that appear in the Bundle or
  • configurable static text (usually braces or separators)

The title pattern can be built by navigating to Manage → Structure → WissKI Entities & Bundles, then selecting the desired Bundle and opening the Title Pattern tab.

Removing all rows and saving is a valid configuration: the bundle then uses the setting for an empty title. When a row cannot be saved, the error message names it by the number shown in the first column and gives the reason, for example a condition that still references a removed row.

Multilingual titles

A title is built for every enabled language. Static text blocks may store a different string per language: the Content column holds the default language, and on multilingual sites a Translate icon opens a dialog for the others (filled translations invert the icon; the tooltip lists their language codes); a language without its own string uses the default label. A Path without a value in a language uses its value in the Bundle's default language, which is set under Configuration → Regional and language → Content language and translation. Only the missing part falls back: a German name stays German even when the place of birth exists only in English. Titles are stored for all languages at once, so "Interface text language selected for page" and "Author's preferred language" use the site's default language, as do "Not specified" and "Not applicable". A language in which the entity has no value at all gets no title of its own; the title in the default language is shown instead. The exception is a static text block translated into that language: when the title contains at least one path value, the language gets its own title from the translated text and the default-language values, e.g. "von Hans" on a German page for a name without a language tag. A field that is not translatable has one value for all languages. Changing the default language of a bundle rebuilds its titles; their stored copies follow on the next cron run.

Stored labels

Each Entity keeps a copy of its title in SQL so that lists and Views can sort by it. Saving an entity updates its own copy right away. When a title shows another entity (through an entity reference, a group or a disambiguated Path such as a place name), or when the title pattern of a Bundle changes, the copies of the affected entities are refreshed on the next cron run. A disambiguated value is only traced back to its entity if it was saved with its disambiguation, for example through the entity form; values saved without it are found after the entity is saved again.

Titles that are generated for display follow right away, without waiting for cron: the "Label (WissKI)" formatter and the WissKI Link Formatter with "Use title pattern" show the new title as soon as the embedded entity is saved. The page heading of an entity uses its stored copy and follows after the next cron run. After updating WissKI, run the database updates (drush updb) once, so that titles cached before the update are rebuilt with these dependencies.