interface ElementInterface

Same name in this branch
  1. 10 core/lib/Drupal/Core/Render/Element/ElementInterface.php \Drupal\Core\Render\Element\ElementInterface
Same name in other branches
  1. 9 core/modules/config_translation/src/FormElement/ElementInterface.php \Drupal\config_translation\FormElement\ElementInterface
  2. 9 core/lib/Drupal/Core/Render/Element/ElementInterface.php \Drupal\Core\Render\Element\ElementInterface
  3. 8.9.x core/modules/config_translation/src/FormElement/ElementInterface.php \Drupal\config_translation\FormElement\ElementInterface
  4. 8.9.x core/lib/Drupal/Core/Render/Element/ElementInterface.php \Drupal\Core\Render\Element\ElementInterface
  5. 11.x core/modules/config_translation/src/FormElement/ElementInterface.php \Drupal\config_translation\FormElement\ElementInterface
  6. 11.x core/lib/Drupal/Core/Render/Element/ElementInterface.php \Drupal\Core\Render\Element\ElementInterface

Provides an interface for configuration translation form elements.

Hierarchy

Expanded class hierarchy of ElementInterface

All classes that implement ElementInterface

File

core/modules/config_translation/src/FormElement/ElementInterface.php, line 13

Namespace

Drupal\config_translation\FormElement
View source
interface ElementInterface {
    
    /**
     * Creates a form element instance from a schema definition.
     *
     * @param \Drupal\Core\TypedData\TypedDataInterface $schema
     *   The configuration schema.
     *
     * @return static
     */
    public static function create(TypedDataInterface $schema);
    
    /**
     * Builds a render array containing the source and translation form elements.
     *
     * @param \Drupal\Core\Language\LanguageInterface $source_language
     *   The source language of the configuration object.
     * @param \Drupal\Core\Language\LanguageInterface $translation_language
     *   The language to display the translation form for.
     * @param mixed $source_config
     *   The configuration value of the element in the source language.
     * @param mixed $translation_config
     *   The configuration value of the element in the language to translate to.
     * @param array $parents
     *   Parents array for the element in the form.
     * @param string|null $base_key
     *   (optional) Base key to be used for the elements in the form. NULL for
     *   top-level form elements.
     *
     * @return array
     *   A render array consisting of the source and translation elements for the
     *   source value.
     */
    public function getTranslationBuild(LanguageInterface $source_language, LanguageInterface $translation_language, $source_config, $translation_config, array $parents, $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.
     *
     * @param \Drupal\Core\Config\Config $base_config
     *   Base configuration values, in the source language.
     * @param \Drupal\language\Config\LanguageConfigOverride $config_translation
     *   Translation configuration override data.
     * @param mixed $config_values
     *   The configuration value of the element taken from the form values.
     * @param 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.
     */
    public function setConfig(Config $base_config, LanguageConfigOverride $config_translation, $config_values, $base_key = NULL);

}

Members

Title Sort descending Modifiers Object type Summary Overrides
ElementInterface::create public static function Creates a form element instance from a schema definition. 2
ElementInterface::getTranslationBuild public function Builds a render array containing the source and translation form elements. 2
ElementInterface::setConfig public function Sets configuration based on a nested form value array. 2

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.