Jet\MVC_Base_LocalizedData

What a base is and how it works we explained here and here. In the table, you will find an overview of the methods of the Jet\MVC_Base_LocalizedData class and also the Jet\MVC_Base_LocalizedData_Interface interface (the class is instantiated principally by factory).

Basic localization parameters

Method Meaning
public getBase(
): MVC_Base_Interface;
Returns the identity of the base to which the localization belongs. Thus, the de facto parent entity.
public setBase(
MVC_Base_Interface $base
): void;
Sets the base to which the localization belongs.
public getLocale(
): Locale;
Returns the data localization identification.
public setLocale(
Locale $locale
): void;
Sets the data localization identification.
public getIsActive(
): bool;
Indicates whether or not the given base localization is active.
public setIsActive(
bool $is_active
): void;
Activates/deactivates the given base localization.
public getTitle(
): string;
Returns the default header of the given base localization. The headline can be used in the end-user output. More precisely, this value is directly expected to be used for example for
public setTitle(
string $title
): void;
Sets the default headline for the given base localization.
public getURLs(
): array;
Returns a list of all URLs for the given locale. The URL contains the domain and path. Not the schema/prefix. https://, or http://. URLs must always end with a locator (the '/' character)
For example: [
'domain/en/',
'en.domain/',
]
public setURLs(
array $URLs
): void;
Sets a list of all URLs for a given locale. The URL contains the domain and path. Not the schema/prefix. https://, or http://. URLs must always end with a locator (the '/' character)

The first URL in the list will be taken as the default. All other URLs are also valid, but will be redirected to the default URL.

For example: [
'domain/en/',
'en.domain/',
]
public getDefaultURL(
): string;
Returns the default URL.
public getSSLRequired(
): bool;
Indicates whether or not the localization requires an https connection.
public setSSLRequired(
bool $SSL_required
): void;
Sets whether the localization requires/does not require an https connection.
public toArray(
): array;
Returns the localized database definition data in the form of an associated array. It is used to store the definition.

Meta tagy

Sometimes you may need to define default meta tags that will then be valid for all pages in a given locale (unless a page overrides them with its own value).

Method Meaning
public getDefaultMetaTags(
): MVC_Base_LocalizedData_MetaTag_Interface[];
Returns an array of default meta tags for the given localization.
public addDefaultMetaTag(
MVC_Base_LocalizedData_MetaTag_Interface $default_meta_tag
): void;
Adds the default meta tag to the given localization.
public removeDefaultMetaTag(
int $index
): void;
Fetches the meta tag at the given position. ($index = 0 means first in the list and so on)
public setDefaultMetaTags(
MVC_Base_LocalizedData_MetaTag_Interface[] $default_meta_tags
): void;
Sets new default meta tags in bulk. It completely removes the old settings and replaces them with the new ones.

Internal parameters

These are your freely selectable parameters and their values. All usable by your application.

Use? Well, imagine you're running an e-shop. You probably need to define a currency code (or codes) tied to a given locale. Or, for example, rounding settings and so on. In short, any value you need to change according to the current base and its localization.

Method Meaning
public getParameters(
): array
Returns a list of internal parameters in a similarly associated array, where the key is the parameter name.
public setParameters(
array $parameters
): void
Bulk sets the parameters for the given localization of the given base. The parameters are again in the form of an associated array.
public setParameter
string $key, 
mixed $value 
): void
Sets one parameter.
public getParameter(
string $key,
mixed $default_value = null
): mixed
Returns the value of the specified parameter. If the specified parameter does not exist, then it returns the default value.
public parameterExists(
string $key
): bool
Checks if the parameter exists.
Previous chapter
Jet\MVC_Base
Next chapter
Jet\MVC_Base_LocalizedData_MetaTag