Description
While working on backdrop-contrib/d2b_migrate#58, I noticed that adding '#indentation' => 1,
to various form elements would work as expected for all of them, with the exception of a submit button:
This is the code used to generate that portion of the form:
$form['warning_container'] = array(
'#type' => 'container',
'#attributes' => array('class' => array('messages', 'warning')),
'#states' => $states,
'#indentation' => 1,
);
$form['warning_container']['warning'] = array(
'#type' => 'markup',
'#markup' => t('<strong>This method is unreliable!</strong> Use this tool with caution.'),
);
$form['source_url'] = array(
'#type' => 'textfield',
'#title' => t('URL of the source Drupal 7 site'),
'#default_value' => '',
'#required' => TRUE,
'#states' => $states,
'#indentation' => 1,
);
$form['backup'] = array(
'#type' => 'submit',
'#submit' => array('d2b_migrate_files_form_backup'),
'#value' => t('Copy files'),
'#disabled' => empty($source),
'#states' => $states,
'#indentation' => 1,
);
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Next: prepare for upgrade'),
'#submit' => array('d2b_migrate_files_form_submit'),
'#limit_validation_errors' => array(),
'#disabled' => empty($source),
);
return $form;
As you can see from the screenshot above, the message (combination of a '#type' => 'container'
+ a '#type' => 'markup'
) as well as the text field and its label all respect the '#indentation' => 1
property, whereas the grey "Copy files" submit button does not respect it.
Even if we add the same '#indentation' => 1
property to either the '#type' => 'submit'
element within the '#type' => 'actions'
parent/container, or add it to the container/parent itself, then that entire actions element (the blue submit button) will also respect that indentation specified: