Commit 44e0f2f9 authored by alexpott's avatar alexpott

Issue #2473945 by Cottser, rachel_norfolk, axe312, davidhernandez, yannickoo,...

Issue #2473945 by Cottser, rachel_norfolk, axe312, davidhernandez, yannickoo, emma.maria, cilefen, akalata, jaxxed, LewisNyman: Prefix form-item classes with js-
parent db342cbd
......@@ -92,7 +92,7 @@
var $source = $context.find(source_id).addClass('machine-name-source').once('machine-name');
var $target = $context.find(options.target).addClass('machine-name-target');
var $suffix = $context.find(options.suffix);
var $wrapper = $target.closest('.form-item');
var $wrapper = $target.closest('.js-form-item');
// All elements have to exist.
if (!$source.length || !$target.length || !$suffix.length || !$wrapper.length) {
return;
......
......@@ -596,7 +596,7 @@
if (e.trigger) {
$(e.target)
.prop('disabled', e.value)
.closest('.form-item, .js-form-submit, .js-form-wrapper').toggleClass('form-disabled', e.value)
.closest('.js-form-item, .js-form-submit, .js-form-wrapper').toggleClass('form-disabled', e.value)
.find('select, input, textarea').prop('disabled', e.value);
// Note: WebKit nightlies don't reflect that change correctly.
......@@ -607,21 +607,21 @@
$(document).on('state:required', function (e) {
if (e.trigger) {
if (e.value) {
var $label = $(e.target).attr({'required': 'required', 'aria-required': 'aria-required'}).closest('.form-item, .js-form-wrapper').find('label');
var $label = $(e.target).attr({'required': 'required', 'aria-required': 'aria-required'}).closest('.js-form-item, .js-form-wrapper').find('label');
// Avoids duplicate required markers on initialization.
if (!$label.hasClass('js-form-required').length) {
$label.addClass('js-form-required form-required');
}
}
else {
$(e.target).removeAttr('required aria-required').closest('.form-item, .js-form-wrapper').find('label.js-form-required').removeClass('js-form-required form-required');
$(e.target).removeAttr('required aria-required').closest('.js-form-item, .js-form-wrapper').find('label.js-form-required').removeClass('js-form-required form-required');
}
}
});
$(document).on('state:visible', function (e) {
if (e.trigger) {
$(e.target).closest('.form-item, .js-form-submit, .js-form-wrapper').toggle(e.value);
$(e.target).closest('.js-form-item, .js-form-submit, .js-form-wrapper').toggle(e.value);
}
});
......
......@@ -76,7 +76,7 @@
var that = this;
$(context).find('[name="filters[filter_html][settings][allowed_html]"]').once('filter-filter_html-updating').each(function () {
that.$allowedHTMLFormItem = $(this);
that.$allowedHTMLDescription = that.$allowedHTMLFormItem.closest('.form-item').find('.description');
that.$allowedHTMLDescription = that.$allowedHTMLFormItem.closest('.js-form-item').find('.description');
that.userTags = that._parseSetting(this.value);
// Update the new allowed tags based on added text editor features.
......
......@@ -15,7 +15,7 @@
* @ingroup themeable
*/
#}
<div class="js-text-format-wrapper">
<div class="js-text-format-wrapper js-form-item form-item">
{{ children }}
{% if description %}
<div{{ attributes }}>{{ description }}</div>
......
......@@ -23,6 +23,7 @@
{% for language_type in language_types %}
{%
set language_classes = [
'js-form-item',
'form-item',
'table-language-group',
'table-' ~ language_type.type ~ '-wrapper',
......
......@@ -36,7 +36,7 @@
$row.addClass('changed');
// Add an asterisk only once if row changed.
if ($rowToMark.length) {
$rowToMark.find('td:first-child .form-item').append(marker);
$rowToMark.find('td:first-child .js-form-item').append(marker);
}
});
}
......
......@@ -20,7 +20,7 @@
*/
#}
{% if multiple %}
<div class="form-item">
<div class="js-form-item form-item">
{{ table }}
{% if description %}
<div class="description">{{ description }}</div>
......
......@@ -24,6 +24,7 @@
#}
{%
set classes = [
'js-form-item',
'form-item',
'js-form-wrapper',
'form-wrapper',
......
......@@ -48,6 +48,7 @@
#}
{%
set classes = [
'js-form-item',
'form-item',
'js-form-type-' ~ type|clean_class,
'form-item-' ~ name|clean_class,
......
......@@ -154,7 +154,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) {
$vocabulary = $this->vocabularyStorage->load($this->options['vid']);
if (empty($vocabulary) && $this->options['limit']) {
$form['markup'] = array(
'#markup' => '<div class="form-item">' . $this->t('An invalid vocabulary is selected. Please change it in the options.') . '</div>',
'#markup' => '<div class="js-form-item form-item">' . $this->t('An invalid vocabulary is selected. Please change it in the options.') . '</div>',
);
return;
}
......
......@@ -22,7 +22,7 @@
var $summary = $widget.find('.js-text-summary-wrapper');
var $summaryLabel = $summary.find('label').eq(0);
var $full = $widget.find('.js-text-full').closest('.form-item');
var $full = $widget.find('.js-text-full').closest('.js-form-item');
var $fullLabel = $full.find('label').eq(0);
// Create a placeholder label when the field cardinality is greater
......
......@@ -69,7 +69,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['description'] = array(
'#type' => 'container',
'#attributes' => array(
'class' => array('form-item', 'description'),
'class' => array('js-form-item', 'form-item', 'description'),
),
'description_top' => array(
'#markup' => '<p>' . $description_top . '</p>',
......
......@@ -1543,7 +1543,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$access_plugin = $this->getPlugin('access');
if ($access_plugin->usesOptions()) {
$form['markup'] = array(
'#prefix' => '<div class="form-item description">',
'#prefix' => '<div class="js-form-item form-item description">',
'#markup' => $this->t('You may also adjust the !settings for the currently selected access restriction.', array('!settings' => $this->optionLink(t('settings'), 'access_options'))),
'#suffix' => '</div>',
);
......@@ -1580,7 +1580,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$cache_plugin = $this->getPlugin('cache');
if ($cache_plugin->usesOptions()) {
$form['markup'] = array(
'#prefix' => '<div class="form-item description">',
'#prefix' => '<div class="js-form-item form-item description">',
'#suffix' => '</div>',
'#markup' => $this->t('You may also adjust the !settings for the currently selected cache mechanism.', array('!settings' => $this->optionLink(t('settings'), 'cache_options'))),
);
......@@ -1652,7 +1652,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
if ($style_plugin->usesOptions()) {
$form['markup'] = array(
'#prefix' => '<div class="form-item description">',
'#prefix' => '<div class="js-form-item form-item description">',
'#suffix' => '</div>',
'#markup' => $this->t('You may also adjust the !settings for the currently selected style.', array('!settings' => $this->optionLink(t('settings'), 'style_options'))),
);
......@@ -1700,7 +1700,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
if ($row_plugin_instance->usesOptions()) {
$form['markup'] = array(
'#prefix' => '<div class="form-item description">',
'#prefix' => '<div class="js-form-item form-item description">',
'#suffix' => '</div>',
'#markup' => $this->t('You may also adjust the !settings for the currently selected row style.', array('!settings' => $this->optionLink(t('settings'), 'row_options'))),
);
......@@ -1767,7 +1767,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
case 'exposed_block':
$form['#title'] .= $this->t('Put the exposed form in a block');
$form['description'] = array(
'#markup' => '<div class="description form-item">' . $this->t('If set, any exposed widgets will not appear with this view. Instead, a block will be made available to the Drupal block administration system, and the exposed form will appear there. Note that this block must be enabled manually, Views will not enable it for you.') . '</div>',
'#markup' => '<div class="js-form-item form-item description">' . $this->t('If set, any exposed widgets will not appear with this view. Instead, a block will be made available to the Drupal block administration system, and the exposed form will appear there. Note that this block must be enabled manually, Views will not enable it for you.') . '</div>',
);
$form['exposed_block'] = array(
'#type' => 'radios',
......@@ -1795,7 +1795,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$exposed_form_plugin = $this->getPlugin('exposed_form');
if ($exposed_form_plugin->usesOptions()) {
$form['markup'] = array(
'#prefix' => '<div class="form-item description">',
'#prefix' => '<div class="js-form-item form-item description">',
'#suffix' => '</div>',
'#markup' => $this->t('You may also adjust the !settings for the currently selected style.', array('!settings' => $this->optionLink(t('settings'), 'exposed_form_options'))),
);
......@@ -1831,7 +1831,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$pager_plugin = $this->getPlugin('pager');
if ($pager_plugin->usesOptions()) {
$form['markup'] = array(
'#prefix' => '<div class="form-item description">',
'#prefix' => '<div class="js-form-item form-item description">',
'#suffix' => '</div>',
'#markup' => $this->t('You may also adjust the !settings for the currently selected pager.', array('!settings' => $this->optionLink(t('settings'), 'pager_options'))),
);
......
......@@ -366,7 +366,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
}
$form['tab_markup'] = array(
'#markup' => '<div class="form-item description">' . $this->t('When providing a menu item as a tab, Drupal needs to know what the parent menu item of that tab will be. Sometimes the parent will already exist, but other times you will need to have one created. The path of a parent item will always be the same path with the last part left off. i.e, if the path to this view is <em>foo/bar/baz</em>, the parent path would be <em>foo/bar</em>.') . '</div>',
'#markup' => '<div class="js-form-item form-item description">' . $this->t('When providing a menu item as a tab, Drupal needs to know what the parent menu item of that tab will be. Sometimes the parent will already exist, but other times you will need to have one created. The path of a parent item will always be the same path with the last part left off. i.e, if the path to this view is <em>foo/bar/baz</em>, the parent path would be <em>foo/bar</em>.') . '</div>',
);
$form['tab_options'] = array(
......
......@@ -413,7 +413,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
);
$form['description_markup'] = array(
'#markup' => '<div class="description form-item">' . $this->t('Place fields into columns; you may combine multiple fields into the same column. If you do, the separator in the column specified will be used to separate the fields. Check the sortable box to make that column click sortable, and check the default sort radio to determine which column will be sorted by default, if any. You may control column order and field labels in the fields section.') . '</div>',
'#markup' => '<div class="js-form-item form-item description">' . $this->t('Place fields into columns; you may combine multiple fields into the same column. If you do, the separator in the column specified will be used to separate the fields. Check the sortable box to make that column click sortable, and check the default sort radio to determine which column will be sorted by default, if any. You may control column order and field labels in the fields section.') . '</div>',
);
}
......
......@@ -162,7 +162,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
}
else {
$form['options']['markup'] = array(
'#markup' => '<div class="form-item">' . $this->t('There are no @types available to add.', array('@types' => $ltitle)) . '</div>',
'#markup' => '<div class="js-form-item form-item">' . $this->t('There are no @types available to add.', array('@types' => $ltitle)) . '</div>',
);
}
// Add a div to show the selected items
......
......@@ -44,7 +44,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$messages = $analyzer->getMessages($view->getExecutable());
$form['analysis'] = array(
'#prefix' => '<div class="form-item">',
'#prefix' => '<div class="js-form-item form-item">',
'#suffix' => '</div>',
'#markup' => $analyzer->formatMessages($messages),
);
......
......@@ -160,7 +160,7 @@ public function buildForm(array $form, FormStateInterface $form_state, Request $
$form['options']['form_description'] = array(
'#markup' => $handler->definition['help'],
'#theme_wrappers' => array('container'),
'#attributes' => array('class' => array('form-item description')),
'#attributes' => array('class' => array('js-form-item form-item description')),
'#weight' => -1000,
);
}
......
......@@ -13,7 +13,7 @@
* @see template_preprocess_text_format_wrapper()
*/
#}
<div class="js-text-format-wrapper text-format-wrapper form-item">
<div class="js-text-format-wrapper text-format-wrapper js-form-item form-item">
{{ children }}
{% if description %}
{%
......
......@@ -18,7 +18,7 @@
*/
#}
{% if multiple %}
<div class="form-item">
<div class="js-form-item form-item">
{{ table }}
{% if description %}
<div class="description">{{ description }}</div>
......
......@@ -22,6 +22,7 @@
#}
{%
set classes = [
'js-form-item',
'form-item',
'js-form-wrapper',
'form-wrapper',
......
......@@ -46,6 +46,7 @@
#}
{%
set classes = [
'js-form-item',
'form-item',
'js-form-type-' ~ type|clean_class,
'form-type-' ~ type|clean_class,
......
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