8000 FAPI: Single input elements outside `'#type' => 'actions'` do not respect the `#indentation` property · Issue #6463 · backdrop/backdrop-issues · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
FAPI: Single input elements outside '#type' => 'actions' do not respect the #indentation property #6463
Open
backdrop/backdrop
#4702
@klonos

Description

@klonos

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:

image

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:
image

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0