diff --git a/core/modules/node/content_types.js b/core/modules/node/content_types.js index eed93f0..91ab7cb 100644 --- a/core/modules/node/content_types.js +++ b/core/modules/node/content_types.js @@ -26,7 +26,7 @@ }); $context.find('#edit-workflow').drupalSetSummary(function (context) { var vals = []; - $(context).find('input[name^="options"]:checked').parent().each(function () { + $(context).find('[data-drupal-selector^="edit-options-"]:checked').next('[data-drupal-selector="option-label"]').each(function () { vals.push(Drupal.checkPlain($(this).text())); }); if (!$(context).find('#edit-options-status').is(':checked')) { diff --git a/core/modules/node/src/NodeTypeForm.php b/core/modules/node/src/NodeTypeForm.php index abef502..83b4791 100644 --- a/core/modules/node/src/NodeTypeForm.php +++ b/core/modules/node/src/NodeTypeForm.php @@ -154,6 +154,12 @@ public function form(array $form, FormStateInterface $form_state) { ], '#description' => t('Users with the Administer content permission will be able to override these options.'), ]; + $js_options = ['status', 'promote', 'sticky', 'revision']; + foreach ($js_options as $option) { + $form['workflow']['options'][$option]['#label_attributes'] = [ + 'data-drupal-selector' => ['option-label'], + ]; + } if ($this->moduleHandler->moduleExists('language')) { $form['language'] = [ '#type' => 'details', diff --git a/core/modules/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php b/core/modules/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php new file mode 100644 index 0000000..898996d --- /dev/null +++ b/core/modules/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php @@ -0,0 +1,49 @@ +drupalCreateUser(['administer content types']); + $this->drupalLogin($admin_user); + $this->drupalCreateContentType(['type' => 'test']); + } + + /** + * Test a vertical tab 'Publishing options' summary. + */ + public function testWorkflowSummary() { + $this->drupalGet('admin/structure/types/manage/test'); + $page = $this->getSession()->getPage(); + $page->findField('options[status]')->uncheck(); + $page->findField('options[sticky]')->check(); + $page->findField('options[promote]')->check(); + $page->findField('options[revision]')->check(); + $locator = '[href="#edit-workflow"] .vertical-tabs__menu-item-summary'; + $page->waitFor(10, function () use ($page, $locator) { + $summary = $page->find('css', $locator)->getText(); + return strpos('Not published', $summary) !== FALSE; + }); + $summary = $page->find('css', $locator)->getText(); + $this->assertEquals('Not published, Promoted to front page, Sticky at top of lists, Create new revision', $summary); + } + +}