Skip to content
Snippets Groups Projects

Initialise properties of form before checking them.

Closed Daniel Harper requested to merge issue/themable_forms-3423960:8.x-1.x into 8.x-1.x
1 file
+ 3
3
Compare changes
  • Side-by-side
  • Inline
+ 3
3
@@ -58,7 +58,7 @@ function themable_forms_preprocess_form_element(array &$variables) {
@@ -58,7 +58,7 @@ function themable_forms_preprocess_form_element(array &$variables) {
/**
/**
* Implements hook_form_alter().
* Implements hook_form_alter().
*/
*/
function themable_forms_form_alter(&$form, FormStateInterface $form_state, $form_id) {
function themable_forms_form_alter(array &$form, FormStateInterface $form_state, $form_id) {
themable_forms_attach_form_id($form, $form_id);
themable_forms_attach_form_id($form, $form_id);
}
}
@@ -72,8 +72,8 @@ function themable_forms_form_alter(&$form, FormStateInterface $form_state, $form
@@ -72,8 +72,8 @@ function themable_forms_form_alter(&$form, FormStateInterface $form_state, $form
*/
*/
function themable_forms_attach_form_id(array &$form, $form_id) {
function themable_forms_attach_form_id(array &$form, $form_id) {
foreach (Element::children($form) as $child) {
foreach (Element::children($form) as $child) {
if (!isset($form[$child]['#form_id'])) {
if (!isset($form[$child]['#attached']['data']['form_id'])) {
$form[$child]['#form_id'] = $form_id;
$form[$child]['#attached']['data']['form_id'] = $form_id;
}
}
themable_forms_attach_form_id($form[$child], $form_id);
themable_forms_attach_form_id($form[$child], $form_id);
}
}
Loading