Commit d4bef057 authored by alexpott's avatar alexpott

Issue #2473957 by sqndr, Cottser, LewisNyman: Prefix text-* classes with js-

parent f213f859
...@@ -78,7 +78,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen ...@@ -78,7 +78,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
'#default_value' => $items[$delta]->value, '#default_value' => $items[$delta]->value,
'#rows' => $this->getSetting('rows'), '#rows' => $this->getSetting('rows'),
'#placeholder' => $this->getSetting('placeholder'), '#placeholder' => $this->getSetting('placeholder'),
'#attributes' => array('class' => array('text-full')), '#attributes' => array('class' => array('js-text-full', 'text-full')),
); );
return $element; return $element;
......
...@@ -79,7 +79,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen ...@@ -79,7 +79,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
'#size' => $this->getSetting('size'), '#size' => $this->getSetting('size'),
'#placeholder' => $this->getSetting('placeholder'), '#placeholder' => $this->getSetting('placeholder'),
'#maxlength' => $this->getFieldSetting('max_length'), '#maxlength' => $this->getFieldSetting('max_length'),
'#attributes' => array('class' => array('text-full')), '#attributes' => array('class' => array('js-text-full', 'text-full')),
); );
return $element; return $element;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* @ingroup themeable * @ingroup themeable
*/ */
#} #}
<div> <div class="js-text-format-wrapper">
{{ children }} {{ children }}
{% if description %} {% if description %}
<div{{ attributes }}>{{ description }}</div> <div{{ attributes }}>{{ description }}</div>
......
...@@ -78,8 +78,8 @@ function formElement(FieldItemListInterface $items, $delta, array $element, arra ...@@ -78,8 +78,8 @@ function formElement(FieldItemListInterface $items, $delta, array $element, arra
'#attached' => array( '#attached' => array(
'library' => array('text/drupal.text'), 'library' => array('text/drupal.text'),
), ),
'#attributes' => array('class' => array('text-summary')), '#attributes' => array('class' => array('js-text-summary', 'text-summary')),
'#prefix' => '<div class="text-summary-wrapper">', '#prefix' => '<div class="js-text-summary-wrapper text-summary-wrapper">',
'#suffix' => '</div>', '#suffix' => '</div>',
'#weight' => -10, '#weight' => -10,
); );
......
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
*/ */
Drupal.behaviors.textSummary = { Drupal.behaviors.textSummary = {
attach: function (context, settings) { attach: function (context, settings) {
$(context).find('.text-summary').once('text-summary').each(function () { $(context).find('.js-text-summary').once('text-summary').each(function () {
var $widget = $(this).closest('.text-format-wrapper'); var $widget = $(this).closest('.js-text-format-wrapper');
var $summary = $widget.find('.text-summary-wrapper'); var $summary = $widget.find('.js-text-summary-wrapper');
var $summaryLabel = $summary.find('label').eq(0); var $summaryLabel = $summary.find('label').eq(0);
var $full = $widget.find('.text-full').closest('.form-item'); var $full = $widget.find('.js-text-full').closest('.form-item');
var $fullLabel = $full.find('label').eq(0); var $fullLabel = $full.find('label').eq(0);
// Create a placeholder label when the field cardinality is greater // Create a placeholder label when the field cardinality is greater
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
}).appendTo($summaryLabel); }).appendTo($summaryLabel);
// If no summary is set, hide the summary field. // If no summary is set, hide the summary field.
if ($widget.find('.text-summary').val() === '') { if ($widget.find('.js-text-summary').val() === '') {
$link.trigger('click'); $link.trigger('click');
} }
}); });
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* @see template_preprocess_text_format_wrapper() * @see template_preprocess_text_format_wrapper()
*/ */
#} #}
<div class="text-format-wrapper form-item"> <div class="js-text-format-wrapper text-format-wrapper form-item">
{{ children }} {{ children }}
{% if description %} {% if description %}
{% {%
......
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