Commit 02417da6 authored by webchick's avatar webchick
Browse files

Issue #1892182 by sun, nod_, jibran: #type details: Rename #collapsed to #open.

parent a9be94a5
......@@ -1004,7 +1004,7 @@ function form_get_options($element, $key) {
* @param $variables
* An associative array containing:
* - element: An associative array containing the properties of the element.
* Properties used: #attributes, #children, #collapsed, #description, #id,
* Properties used: #attributes, #children, #description, #id,
* #title, #value.
*
* @ingroup themeable
......@@ -1071,7 +1071,7 @@ function theme_fieldset($variables) {
* @param array $variables
* An associative array containing:
* - element: An associative array containing the properties of the element.
* Properties used: #attributes, #children, #collapsed, #collapsible,
* Properties used: #attributes, #children, #open,
* #description, #id, #title, #value, #optional.
*
* @ingroup themeable
......@@ -1085,7 +1085,7 @@ function template_preprocess_details(&$variables) {
if (!empty($element['#attributes']['id'])) {
$variables['summary_attributes']['aria-controls'] = $element['#attributes']['id'];
}
$variables['summary_attributes']['aria-expanded'] = empty($element['#attributes']['open']) ? FALSE : TRUE;
$variables['summary_attributes']['aria-expanded'] = !empty($element['#attributes']['open']);
$variables['summary_attributes']['aria-pressed'] = $variables['summary_attributes']['aria-expanded'];
}
$variables['title'] = (!empty($element['#title'])) ? $element['#title'] : '';
......@@ -2063,7 +2063,7 @@ function form_pre_render_details($element) {
// Collapsible details.
$element['#attached']['library'][] = array('core', 'drupal.collapse');
if (empty($element['#collapsed'])) {
if (!empty($element['#open'])) {
$element['#attributes']['open'] = 'open';
}
......
......@@ -247,7 +247,6 @@ public function getFormOptions(array $database) {
$form['advanced_options'] = array(
'#type' => 'details',
'#title' => t('Advanced options'),
'#collapsed' => TRUE,
'#weight' => 10,
);
......
......@@ -405,7 +405,6 @@ public function getSettingsForm() {
$form['advanced'] = array(
'#type' => 'details',
'#title' => t('Advanced settings'),
'#collapsed' => TRUE,
);
$form['advanced']['hostname'] = array(
'#type' => 'textfield',
......
......@@ -30,7 +30,6 @@ public function buildForm(array $form, array &$form_state) {
$form['start'] = array(
'#tree' => TRUE,
'#type' => 'details',
'#collapsed' => TRUE,
);
// Ensure system.module's updates appear first.
......
......@@ -65,6 +65,7 @@ public function buildForm(array $form, array &$form_state) {
'#type' => 'details',
'#title' => $this->t('Create an advanced action'),
'#attributes' => array('class' => array('container-inline')),
'#open' => TRUE,
);
$form['parent']['action'] = array(
'#type' => 'select',
......
......@@ -145,7 +145,7 @@ public function buildForm(array $form, array &$form_state) {
'#type' => 'details',
'#title' => $this->t('Basic configuration'),
'#description' => $this->t('For most aggregation tasks, the default settings are fine.'),
'#collapsed' => FALSE,
'#open' => TRUE,
);
$form['basic_conf'] += $basic_conf;
}
......
......@@ -83,7 +83,7 @@ public function buildConfigurationForm(array $form, array &$form_state) {
'#type' => 'details',
'#title' => t('Default processor settings'),
'#description' => $info['description'],
'#collapsed' => !in_array($info['id'], $processors),
'#open' => in_array($info['id'], $processors),
);
}
......
......@@ -74,7 +74,7 @@ public function buildConfigurationForm(array $form, array &$form_state) {
'#type' => 'details',
'#title' => t('Test processor settings'),
'#description' => $info['description'],
'#collapsed' => !in_array($info['id'], $processors),
'#open' => in_array($info['id'], $processors),
);
// Add some dummy settings to verify settingsForm is called.
$form['processors'][$info['id']]['dummy_length'] = array(
......
......@@ -134,9 +134,8 @@ public function form(array $form, array &$form_state) {
$form['revision_information'] = array(
'#type' => 'details',
'#title' => $this->t('Revision information'),
'#collapsible' => TRUE,
// Collapsed by default when "Create new revision" is unchecked.
'#collapsed' => !$block->isNewRevision(),
// Open by default when "Create new revision" is checked.
'#open' => $block->isNewRevision(),
'#group' => 'advanced',
'#attributes' => array(
'class' => array('custom-block-form-revision-information'),
......
......@@ -57,8 +57,6 @@ public function form(array $form, array &$form_state) {
$form['language'] = array(
'#type' => 'details',
'#title' => t('Language settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#group' => 'additional_settings',
);
......
......@@ -127,7 +127,6 @@ public function form(array $form, array &$form_state) {
$form['visibility']['path'] = array(
'#type' => 'details',
'#title' => $this->t('Pages'),
'#collapsed' => TRUE,
'#group' => 'visibility',
'#weight' => 0,
);
......@@ -183,7 +182,6 @@ public function form(array $form, array &$form_state) {
$form['visibility']['language'] = array(
'#type' => 'details',
'#title' => $this->t('Languages'),
'#collapsed' => TRUE,
'#group' => 'visibility',
'#weight' => 5,
);
......@@ -216,7 +214,6 @@ public function form(array $form, array &$form_state) {
$form['visibility']['role'] = array(
'#type' => 'details',
'#title' => $this->t('Roles'),
'#collapsed' => TRUE,
'#group' => 'visibility',
'#weight' => 10,
);
......
......@@ -348,6 +348,7 @@ public function buildForm(array $form, array &$form_state) {
$form['place_blocks']['list'][$category_key] = array(
'#type' => 'details',
'#title' => $category,
'#open' => TRUE,
'content' => array(
'#theme' => 'links',
'#links' => array(),
......
......@@ -201,7 +201,6 @@ public function addFormElements(array $form, array &$form_state, NodeInterface $
'#type' => 'details',
'#title' => $this->t('Book outline'),
'#weight' => 10,
'#collapsed' => TRUE,
'#group' => 'advanced',
'#attributes' => array(
'class' => array('book-outline-form'),
......
......@@ -156,6 +156,7 @@ public function injectPluginSettingsForm(array &$form, array &$form_state, Edito
$form['plugins'][$plugin_id] = array(
'#type' => 'details',
'#title' => $definitions[$plugin_id]['label'],
'#open' => TRUE,
'#group' => 'editor][settings][plugin_settings',
'#attributes' => array(
'data-ckeditor-plugin-id' => $plugin_id,
......
......@@ -45,6 +45,7 @@ function color_form_system_theme_settings_alter(&$form, &$form_state) {
$form['color'] = array(
'#type' => 'details',
'#title' => t('Color scheme'),
'#open' => TRUE,
'#weight' => -1,
'#attributes' => array('id' => 'color_scheme_form'),
'#theme' => 'color_scheme_form',
......
......@@ -118,7 +118,6 @@ public function form(array $form, array &$form_state) {
$form['author'] += array(
'#type' => 'details',
'#title' => $this->t('Administration'),
'#collapsed' => TRUE,
);
}
......
......@@ -119,6 +119,7 @@ public function buildForm(array $form, array &$form_state, $type = 'new') {
$form['options'] = array(
'#type' => 'details',
'#title' => $this->t('Update options'),
'#open' => TRUE,
'#attributes' => array('class' => array('container-inline')),
);
......
......@@ -92,8 +92,7 @@ public function instanceSettingsForm(array $form, array &$form_state) {
$element['comment'] = array(
'#type' => 'details',
'#title' => t('Comment form settings'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#open' => TRUE,
'#bundle' => "{$entity_type}__{$field_name}",
'#process' => array(array(get_class($this), 'processSettingsElement')),
'#attributes' => array(
......
......@@ -68,9 +68,9 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
if (isset($form['advanced'])) {
$element += array(
'#type' => 'details',
// Collapse this field when the selected value is the same as stored in
// Open the details when the selected value is different to the stored
// default values for the field instance.
'#collapsed' => ($items->status == $field_default_values[0]['status']),
'#open' => ($items->status != $field_default_values[0]['status']),
'#group' => 'advanced',
'#attributes' => array(
'class' => array('comment-' . drupal_html_class($element['#entity_type']) . '-settings-form'),
......
......@@ -293,8 +293,7 @@ protected function buildConfigForm(Element $schema, $config_data, $base_config_d
$build[$key] = array(
'#type' => 'details',
'#title' => (!empty($title) ? (strip_tags($title) . ' ') : '') . $this->t($definition['label']),
'#collapsible' => TRUE,
'#collapsed' => $collapsed,
'#open' => !$collapsed,
) + $sub_build;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment