Contents

Cms\Components\TranslatableBag

Overview

TranslatableBag stores translated template properties for each site, including the URL.

Extends
Implements
  • Larajax\Contracts\ViewComponentInterface
  • October\Contracts\Twig\CallsAnyMethod
  • Stringable

Public Properties

There are no public properties in the class.

Show inherited public properties

Inherited Public Properties

Protected Properties

There are no protected properties in the class.

Show inherited protected properties

Inherited Protected Properties


Public Methods

public static cleanProperties()

public static cleanProperties(array $properties): array 

cleanProperties drops empty values and the locale key repeated inside each item before saving.

public componentDetails()

public componentDetails(): array 

public defineProperties()

public defineProperties(): array 

defineProperties uses an object list keyed by locale.

public property()

public property(string $name, mixed $default = null): mixed 

property accepts bracket syntax (locales[fr][url]) in addition to dot syntax (locales.fr.url).

public siteProperties()

public siteProperties(
    System\Models\SiteDefinition|null $site = null
): array 

siteProperties returns all translated property values for a site as a single array.

public siteProperty()

public siteProperty(
    string $name,
    System\Models\SiteDefinition|null $site = null,
    mixed $default = null
): mixed 

siteProperty returns a translated property value for a site, matched by locale with language fallback.

public validateProperties()

public validateProperties(array $properties): array 

Show inherited public methods

Inherited Public Methods

Protected Methods

protected listCurrentPropertyNames()

protected listCurrentPropertyNames(): array 

listCurrentPropertyNames returns the current property names in bracket syntax.

protected makeLocaleDescription()

protected makeLocaleDescription(): string 

makeLocaleDescription lists the available site locales as a hint.

protected makeSiteKeyChain()

protected makeSiteKeyChain(System\Models\SiteDefinition $site): array 

makeSiteKeyChain returns the locale lookup keys for a site in priority order.

protected normalizePropertyName()

protected normalizePropertyName(string $name): string 

normalizePropertyName converts bracket syntax to a dot path.

Show inherited protected methods

Inherited Protected Methods