Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By tstoeckler on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.0.x
Introduced in version:
8.0.0-beta3
Issue links:
Description:
Form elements for configurationt translation were revamped to provide more control over the config translation form.
This has resulted in three changes to \Drupal\config_translation\FormElement\ElementInterface
:
ElementInterface::create()
has been introduced to formalize element construction. The new\Drupal\config_translation\FormElement\FormElementBase
implements this method and generally does not need to be overridden.ElementInterface::getFormElement()
has been renamed toElementInterface::getTranslationBuild()
. The "translation" part is to allow for richer form elements in contrib which are not only related to translation. This method is now responsible for returning the entire sub-structure for the specific configuration element: both the source (which is provided to the translator for context) and the form element for entering the translation. A new\Drupal\config_translation\FormElement\FormElementBase
is introduced which helps out with the related logic and provides basegetSourceElement()
andgetTranslationElement()
methods. The latter one needs to be overridden for each implementation.- A new
ElementInterface::setConfig()
is introduced to give form elements more control over setting the configuration values. The new\Drupal\config_translation\FormElement\FormElementBase
implements this method and generally does not need to be overridden.
Take a look at \Drupal\config_translation\FormElement\Textfield
for an example implementation of form elements which extend the base class.
Impacts:
Module developers