function ConfigFormBase::storeConfigKeyToFormElementMap

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Form/ConfigFormBase.php \Drupal\Core\Form\ConfigFormBase::storeConfigKeyToFormElementMap()

#after_build callback which stores a map of element names to config keys.

This will store an array in the form state whose keys are strings in the form of `CONFIG_NAME:PROPERTY_PATH`, and whose values are instances of \Drupal\Core\Form\ConfigTarget.

This callback is run in the form's #after_build stage, rather than #process, to guarantee that all of the form's elements have their final #name and #parents properties set.

Parameters

array $element: The element being processed.

\Drupal\Core\Form\FormStateInterface $form_state: The current form state.

Return value

array The processed element.

See also

\Drupal\Core\Form\ConfigFormBase::buildForm()

File

core/lib/Drupal/Core/Form/ConfigFormBase.php, line 145

Class

ConfigFormBase
Base class for implementing system configuration forms.

Namespace

Drupal\Core\Form

Code

public function storeConfigKeyToFormElementMap(array $element, FormStateInterface $form_state) : array {
    // Empty the map to ensure the information is always correct after
    // rebuilding the form.
    $form_state->set(static::CONFIG_KEY_TO_FORM_ELEMENT_MAP, []);
    return $this->doStoreConfigMap($element, $form_state);
}

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