3 * Javascript for the node content editing form.
6 (function ($, Drupal) {
8 * Behaviors for setting summaries on content type form.
10 * @type {Drupal~behavior}
12 * @prop {Drupal~behaviorAttach} attach
13 * Attaches summary behaviors on content type edit forms.
15 Drupal.behaviors.contentTypes = {
17 const $context = $(context);
18 // Provide the vertical tab summaries.
19 $context.find('#edit-submission').drupalSetSummary((context) => {
21 vals.push(Drupal.checkPlain($(context).find('#edit-title-label').val()) || Drupal.t('Requires a title'));
22 return vals.join(', ');
24 $context.find('#edit-workflow').drupalSetSummary((context) => {
26 $(context).find('input[name^="options"]:checked').next('label').each(function () {
27 vals.push(Drupal.checkPlain($(this).text()));
29 if (!$(context).find('#edit-options-status').is(':checked')) {
30 vals.unshift(Drupal.t('Not published'));
32 return vals.join(', ');
34 $('#edit-language', context).drupalSetSummary((context) => {
37 vals.push($('.js-form-item-language-configuration-langcode select option:selected', context).text());
39 $('input:checked', context).next('label').each(function () {
40 vals.push(Drupal.checkPlain($(this).text()));
43 return vals.join(', ');
45 $context.find('#edit-display').drupalSetSummary((context) => {
47 const $editContext = $(context);
48 $editContext.find('input:checked').next('label').each(function () {
49 vals.push(Drupal.checkPlain($(this).text()));
51 if (!$editContext.find('#edit-display-submitted').is(':checked')) {
52 vals.unshift(Drupal.t("Don't display post information"));
54 return vals.join(', ');