interface ElementInterface (View source)

Provides an interface for configuration translation form elements.

Methods

create(TypedDataInterface $schema)

Creates a form element instance from a schema definition.

array
getTranslationBuild(LanguageInterface $source_language, LanguageInterface $translation_language, mixed $source_config, mixed $translation_config, array $parents, string|null $base_key = NULL)

Builds a render array containing the source and translation form elements.

setConfig(Config $base_config, LanguageConfigOverride $config_translation, mixed $config_values, string|null $base_key = NULL)

Sets configuration based on a nested form value array.

Details

static ElementInterface create(TypedDataInterface $schema)

Creates a form element instance from a schema definition.

Parameters

TypedDataInterface $schema

The configuration schema.

Return Value

ElementInterface

array getTranslationBuild(LanguageInterface $source_language, LanguageInterface $translation_language, mixed $source_config, mixed $translation_config, array $parents, string|null $base_key = NULL)

Builds a render array containing the source and translation form elements.

Parameters

LanguageInterface $source_language

The source language of the configuration object.

LanguageInterface $translation_language

The language to display the translation form for.

mixed $source_config

The configuration value of the element in the source language.

mixed $translation_config

The configuration value of the element in the language to translate to.

array $parents

Parents array for the element in the form.

string|null $base_key

(optional) Base key to be used for the elements in the form. NULL for top-level form elements.

Return Value

array

A render array consisting of the source and translation elements for the source value.

setConfig(Config $base_config, LanguageConfigOverride $config_translation, mixed $config_values, string|null $base_key = NULL)

Sets configuration based on a nested form value array.

If the configuration values are the same as the source configuration, the override should be removed from the translation configuration.

Parameters

Config $base_config

Base configuration values, in the source language.

LanguageConfigOverride $config_translation

Translation configuration override data.

mixed $config_values

The configuration value of the element taken from the form values.

string|null $base_key

(optional) The base key that the schema and the configuration values belong to. This should be NULL for the top-level configuration object and be populated consecutively when recursing into the configuration structure.