The vertical tab summaries for publishing options calls text() on the parent div to collect the summary information. That works fine until you add a #description to the form in an effort to clarify options to content editors.

vt-summary-problem.png

Instead the summary should be pulled from the label of any ticked checkbox.

Comments

mikeker’s picture

Status: Active » Needs review
StatusFileSize
new650 bytes
mikeker’s picture

Issue summary: View changes

Add code formatting

mikeker’s picture

Issue summary: View changes
Issue tags: +JavaScript

Adding tag based on _nod's post.

nod_’s picture

Version: 7.x-dev » 8.x-dev
Status: Needs review » Needs work

I'm guessing this is happening on Drupal 8 as well. We fix bugs in the current dev version before backporting to 7. Can you make a patch for Drupal 8?

Other than that, it looks good to me :)

mikeker’s picture

StatusFileSize
new11.66 KB
new10.62 KB
new627 bytes

Here's the D8 patch. Using the Bartik theme, assuming you add something similar to:

function sandbox_form_node_form_alter(&$form, &$form_state, $form_id) {
  $form['options']['sticky']['#description'] = t('Some descriptive text goes here.');
}

Before:

Before

After:

after

mikeker’s picture

Status: Needs work » Needs review

always forget that...

Status: Needs review » Needs work

The last submitted patch, 4: 2086981-4-vt_publishing_options-d8.patch, failed testing.

nod_’s picture

Status: Needs work » Needs review
droplet’s picture

StatusFileSize
new732 bytes

Personally, I preferred more strictly like this:

            vals.push(Drupal.checkPlain($.trim($this.siblings('label[for="'+ $this[0].id +'"]').text())));
jhedstrom’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

This is related #1919956: Determine when and/or how to display summaries for vertical tabs and details ui components, since these summaries don't show at all currently.

ravi.khetri’s picture

Status: Needs work » Needs review
StatusFileSize
new847 bytes

Re-rolled.

pwieck’s picture

Issue tags: -Needs reroll
shwetaneelsharma’s picture

StatusFileSize
new148.63 KB

Patch "2086981-drupalSetSummary_10.patch" is successfully re-rolled. None of the summaries are being displayed now. Attaching screenshot.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

droplet’s picture

Status: Needs review » Postponed (maintainer needs more info)
Issue tags: +Needs JavaScript testing

Bug isn't existing from my testing.

Anonymous’s picture

Status: Postponed (maintainer needs more info) » Active

@droplet, maybe you tested this issue with patch from #2849100 ?) Because #2849100: Spaces shown before commas in publishing options solves this problem.

#4 update code for reproduce:

function MODULE_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  $form['workflow']['options']['sticky']['#description'] = t('Some descriptive text goes here.');
}
droplet’s picture

@vaplas,

Nope? this is on node creation page. And I hacked CORE with `->setDescription()` directly. (but I'm testing on D8.4)

Anonymous’s picture

I'm tested it with 8.4 too, but on /admin/structure/types/manage/article. On node creation page js-script just not works.

droplet’s picture

StatusFileSize
new24.86 KB

You should change Bartik as admin theme to test. @see:

Anonymous’s picture

Status: Active » Postponed (maintainer needs more info)

oops, i overlooked Bartik point! Thank you, @droplet. I'm also tested it like ->setDescription(...) in Node.php, and like
$form['sticky']['widget']['value']['#description'] = t("Bartik rocks!"); in hook. And cann't reproduce this problem too. Sorry for the noise.

Only local images are allowed.

mikeker’s picture

I believe this was fixed as part of #2389515: Update ESLint rules. Specifically:

+++ b/core/modules/node/node.js
@@ -26,20 +26,20 @@
-        if ($context.find('input').is(':checked')) {
-          $context.find('input:checked').next('label').each(function () {
+        if ($optionsContext.find('input').is(':checked')) {
+          $optionsContext.find('input:checked').next('label').each(function () {
droplet’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

@mikeker, that's equal changes.

Whatever, let's close it :)