Commit 02417da6 authored by webchick's avatar webchick

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;
}
}
......
......@@ -224,6 +224,7 @@ function contact_form_user_form_alter(&$form, &$form_state) {
$form['contact'] = array(
'#type' => 'details',
'#title' => t('Contact settings'),
'#open' => TRUE,
'#weight' => 5,
);
$account = $form_state['controller']->getEntity();
......@@ -258,6 +259,7 @@ function contact_form_user_admin_settings_alter(&$form, &$form_state) {
$form['contact'] = array(
'#type' => 'details',
'#title' => t('Contact settings'),
'#open' => TRUE,
'#weight' => 0,
);
$form['contact']['contact_default_status'] = array(
......
......@@ -112,7 +112,6 @@ public function entityFormAlter(array &$form, array &$form_state, EntityInterfac
$form['source_langcode'] = array(
'#type' => 'details',
'#title' => t('Source language: @language', array('@language' => $languages[$source_langcode]->name)),
'#collapsed' => TRUE,
'#tree' => TRUE,
'#weight' => -100,
'#multilingual' => TRUE,
......@@ -182,7 +181,6 @@ public function entityFormAlter(array &$form, array &$form_state, EntityInterfac
$form['content_translation'] = array(
'#type' => 'details',
'#title' => t('Translation'),
'#collapsed' => TRUE,
'#tree' => TRUE,
'#weight' => 10,
'#access' => $this->getTranslationAccess($entity, $source_langcode ? 'create' : 'update'),
......
......@@ -57,7 +57,6 @@ public function buildForm(array $form, array &$form_state) {
'#type' => 'details',
'#title' => $this->t('Clear log messages'),
'#description' => $this->t('This will permanently remove the log messages from the database.'),
'#collapsed' => TRUE,
);
$form['dblog_clear']['clear'] = array(
'#type' => 'submit',
......
......@@ -30,7 +30,7 @@ public function buildForm(array $form, array &$form_state) {
$form['filters'] = array(
'#type' => 'details',
'#title' => $this->t('Filter log messages'),
'#collapsed' => empty($_SESSION['dblog_overview_filter']),
'#open' => !empty($_SESSION['dblog_overview_filter']),
);
foreach ($filters as $key => $filter) {
$form['filters']['status'][$key] = array(
......
......@@ -186,6 +186,7 @@ public function instanceSettingsForm(array $form, array &$form_state) {
$form['handler'] = array(
'#type' => 'details',
'#title' => t('Reference type'),
'#open' => TRUE,
'#tree' => TRUE,
'#process' => array('_entity_reference_form_process_merge_parent'),
);
......
......@@ -478,7 +478,6 @@ function multiple_options_form(&$form, &$form_state) {
$form['multiple_field_settings'] = array(
'#type' => 'details',
'#title' => t('Multiple field settings'),
'#collapsed' => TRUE,
'#weight' => 5,
);
......
......@@ -60,6 +60,7 @@ function field_test_entity_nested_form($form, &$form_state, EntityInterface $ent
$form['entity_2'] = array(
'#type' => 'details',
'#title' => t('Second entity'),
'#open' => TRUE,
'#tree' => TRUE,
'#parents' => array('entity_2'),
'#weight' => 50,
......
......@@ -186,7 +186,6 @@ public function buildForm(array $form, array &$form_state, $entity_type_id = NUL
$form['modes'] = array(
'#type' => 'details',
'#title' => $this->t('Custom display settings'),
'#collapsed' => TRUE,
);
// Collect options and default values for the 'Custom display settings'
// checkboxes.
......
......@@ -142,6 +142,7 @@ public function buildForm(array $form, array &$form_state, FieldInstanceConfigIn
$element += array(
'#type' => 'details',
'#title' => $this->t('Default value'),
'#open' => TRUE,
'#description' => $this->t('The default value for this field, used when creating new content.'),
);
$form['instance']['default_value'] = $element;
......
......@@ -145,6 +145,7 @@ protected function formMultipleElements(FieldItemListInterface $items, array &$f
// building up the full list (like draggable table rows).
$elements['#file_upload_delta'] = $delta;
$elements['#type'] = 'details';
$elements['#open'] = TRUE;
$elements['#theme'] = 'file_widget_multiple';
$elements['#theme_wrappers'] = array('details');
$elements['#process'] = array(array(get_class($this), 'processMultiple'));
......
......@@ -190,6 +190,7 @@ public function form(array $form, array &$form_state) {
$form['filters']['settings'][$name] = array(
'#type' => 'details',
'#title' => $filter->getLabel(),
'#open' => TRUE,
'#weight' => $filter->weight,
'#parents' => array('filters', $name, 'settings'),
'#group' => 'filter_settings',
......
......@@ -107,7 +107,6 @@ public function buildForm(array $form, array &$form_state) {
$form['new_mapping'] = array(
'#type' => 'details',
'#title' => $this->t('Add a new mapping'),
'#collapsed' => TRUE,
'#tree' => TRUE,
);
$form['new_mapping']['browser_langcode'] = array(
......
......@@ -43,6 +43,7 @@ public function buildForm(array $form, array &$form_state) {
'#type' => 'details',
'#tree' => TRUE,
'#title' => t('Path prefix configuration'),
'#open' => TRUE,
'#description' => t('Language codes or other custom text to use as a path prefix for URL language detection. For the default language, this value may be left blank. <strong>Modifying this value may break existing URLs. Use with caution in a production environment.</strong> Example: Specifying "deutsch" as the path prefix code for German results in URLs like "example.com/deutsch/contact".'),
'#states' => array(
'visible' => array(
......@@ -56,6 +57,7 @@ public function buildForm(array $form, array &$form_state) {
'#type' => 'details',
'#tree' => TRUE,
'#title' => t('Domain configuration'),
'#open' => TRUE,
'#description' => t('The domain names to use for these languages. Leave blank for the default language. Use with caution in a production environment.<strong>Modifying this value may break existing URLs. Use with caution in a production environment.</strong> Example: Specifying "de.example.com" as language domain for German will result in an URL like "http://de.example.com/contact".'),
'#states' => array(
'visible' => array(
......
......@@ -33,7 +33,7 @@ public function buildForm(array $form, array &$form_state) {
$form['filters'] = array(
'#type' => 'details',
'#title' => $this->t('Filter translatable strings'),
'#collapsed' => FALSE,
'#open' => TRUE,
);
foreach ($filters as $key => $filter) {
// Special case for 'string' filter.
......
......@@ -190,7 +190,6 @@ function locale_translate_export_form($form, &$form_state) {
$form['content_options'] = array(
'#type' => 'details',
'#title' => t('Export options'),
'#collapsed' => TRUE,
'#tree' => TRUE,
'#states' => array(
'invisible' => array(
......
......@@ -113,6 +113,7 @@ public function form(array $form, array &$form_state) {
$form['default_menu_links_language'] = array(
'#type' => 'details',
'#title' => t('Menu links language'),
'#open' => TRUE,
);
$form['default_menu_links_language']['default_language'] = array(
'#type' => 'language_configuration',
......
......@@ -474,7 +474,7 @@ function menu_form_node_form_alter(&$form, $form_state) {
'#type' => 'details',
'#title' => t('Menu settings'),
'#access' => \Drupal::currentUser()->hasPermission('administer menu'),
'#collapsed' => !$link['link_title'],
'#open' => !empty($link['link_title']),
'#group' => 'advanced',
'#attached' => array(
'library' => array(array('menu', 'drupal.menu')),
......@@ -593,7 +593,6 @@ function menu_form_node_type_form_alter(&$form, $form_state) {
$form['menu'] = array(
'#type' => 'details',
'#title' => t('Menu settings'),
'#collapsed' => TRUE,
'#attached' => array(
'library' => array(array('menu', 'drupal.menu.admin')),
),
......
......@@ -108,8 +108,8 @@ public function form(array $form, array &$form_state) {
'#type' => 'details',
'#group' => 'advanced',
'#title' => t('Revision information'),
// Collapsed by default when "Create new revision" is unchecked.
'#collapsed' => !$node->isNewRevision(),
// Open by default when "Create new revision" is checked.
'#open' => $node->isNewRevision(),
'#attributes' => array(
'class' => array('node-form-revision-information'),
),
......@@ -147,7 +147,6 @@ public function form(array $form, array &$form_state) {
$form['author'] = array(
'#type' => 'details',
'#title' => t('Authoring information'),
'#collapsed' => TRUE,
'#group' => 'advanced',
'#attributes' => array(
'class' => array('node-form-author'),
......@@ -190,7 +189,6 @@ public function form(array $form, array &$form_state) {
$form['options'] = array(
'#type' => 'details',
'#title' => t('Promotion options'),
'#collapsed' => TRUE,
'#group' => 'advanced',
'#attributes' => array(
'class' => array('node-form-options'),
......
......@@ -74,6 +74,7 @@ public function form(array $form, array &$form_state) {
'#type' => 'details',
'#title' => t('Submission form settings'),
'#group' => 'additional_settings',
'#open' => TRUE,
);
$form['submission']['title_label'] = array(
'#title' => t('Title field label'),
......@@ -108,7 +109,6 @@ public function form(array $form, array &$form_state) {
$form['workflow'] = array(
'#type' => 'details',
'#title' => t('Publishing options'),
'#collapsed' => TRUE,
'#group' => 'additional_settings',
);
$form['workflow']['options'] = array('#type' => 'checkboxes',
......@@ -127,7 +127,6 @@ public function form(array $form, array &$form_state) {
$form['language'] = array(
'#type' => 'details',
'#title' => t('Language settings'),
'#collapsed' => TRUE,
'#group' => 'additional_settings',
);
......@@ -144,7 +143,6 @@ public function form(array $form, array &$form_state) {
$form['display'] = array(
'#type' => 'details',
'#title' => t('Display settings'),
'#collapsed' => TRUE,
'#group' => 'additional_settings',
);
$form['display']['submitted'] = array(
......
......@@ -379,14 +379,12 @@ public function searchFormAlter(array &$form, array &$form_state) {
$form['advanced'] = array(
'#type' => 'details',
'#title' => t('Advanced search'),
'#collapsed' => TRUE,
'#attributes' => array('class' => array('search-advanced')),
'#access' => $this->account && $this->account->hasPermission('use advanced search'),
);
$form['advanced']['keywords-fieldset'] = array(
'#type' => 'fieldset',
'#title' => t('Keywords'),
'#collapsible' => FALSE,
);
$form['advanced']['keywords'] = array(
'#prefix' => '<div class="criterion">',
......@@ -416,7 +414,6 @@ public function searchFormAlter(array &$form, array &$form_state) {
$form['advanced']['types-fieldset'] = array(
'#type' => 'fieldset',
'#title' => t('Types'),
'#collapsible' => FALSE,
);
$form['advanced']['types-fieldset']['type'] = array(
'#type' => 'checkboxes',
......@@ -443,8 +440,6 @@ public function searchFormAlter(array &$form, array &$form_state) {
$form['advanced']['lang-fieldset'] = array(
'#type' => 'fieldset',
'#title' => t('Languages'),
'#collapsible' => FALSE,
'#collapsed' => FALSE,
);
$form['advanced']['lang-fieldset']['language'] = array(
'#type' => 'checkboxes',
......@@ -556,6 +551,7 @@ public function buildConfigurationForm(array $form, array &$form_state) {
$form['content_ranking'] = array(
'#type' => 'details',
'#title' => t('Content ranking'),
'#open' => TRUE,
);
$form['content_ranking']['#theme'] = 'node_search_admin';
$form['content_ranking']['info'] = array(
......
......@@ -1070,7 +1070,6 @@ function node_form_block_form_alter(&$form, &$form_state) {
$form['visibility']['node_type'] = array(
'#type' => 'details',
'#title' => t('Content types'),
'#collapsed' => TRUE,
'#group' => 'visibility',
'#weight' => 5,
);
......
......@@ -283,8 +283,10 @@ function path_admin_form_submit($form, &$form_state) {
*/
function path_admin_filter_form($form, &$form_state, $keys = '') {
$form['#attributes'] = array('class' => array('search-form'));
$form['basic'] = array('#type' => 'details',
$form['basic'] = array(
'#type' => 'details',
'#title' => t('Filter aliases'),
'#open' => TRUE,
'#attributes' => array('class' => array('container-inline')),
);
$form['basic']['filter'] = array(
......
......@@ -97,7 +97,7 @@ function path_form_node_form_alter(&$form, $form_state) {
$form['path'] = array(
'#type' => 'details',
'#title' => t('URL path settings'),
'#collapsed' => empty($path['alias']),
'#open' => !empty($path['alias']),
'#group' => 'advanced',
'#attributes' => array(
'class' => array('path-form'),
......
......@@ -158,6 +158,7 @@ public function buildForm(array $form, array &$form_state) {
$form['status'] = array(
'#type' => 'details',
'#title' => $this->t('Indexing status'),
'#open' => TRUE,
);
$form['status']['status'] = array('#markup' => $status);
$form['status']['wipe'] = array(
......@@ -171,7 +172,8 @@ public function buildForm(array $form, array &$form_state) {
// Indexing throttle:
$form['indexing_throttle'] = array(
'#type' => 'details',
'#title' => $this->t('Indexing throttle')
'#title' => $this->t('Indexing throttle'),
'#open' => TRUE,
);
$form['indexing_throttle']['cron_limit'] = array(
'#type' => 'select',
......@@ -183,7 +185,8 @@ public function buildForm(array $form, array &$form_state) {
// Indexing settings:
$form['indexing_settings'] = array(
'#type' => 'details',
'#title' => $this->t('Indexing settings')
'#title' => $this->t('Indexing settings'),
'#open' => TRUE,
);