Added Entity and Entity Reference Revisions which got dropped somewhere along the...
[yaffs-website] / web / core / modules / node / content_types.es6.js
1 /**
2  * @file
3  * Javascript for the node content editing form.
4  */
5
6 (function($, Drupal) {
7   /**
8    * Behaviors for setting summaries on content type form.
9    *
10    * @type {Drupal~behavior}
11    *
12    * @prop {Drupal~behaviorAttach} attach
13    *   Attaches summary behaviors on content type edit forms.
14    */
15   Drupal.behaviors.contentTypes = {
16     attach(context) {
17       const $context = $(context);
18       // Provide the vertical tab summaries.
19       $context.find('#edit-submission').drupalSetSummary(context => {
20         const vals = [];
21         vals.push(
22           Drupal.checkPlain(
23             $(context)
24               .find('#edit-title-label')
25               .val(),
26           ) || Drupal.t('Requires a title'),
27         );
28         return vals.join(', ');
29       });
30       $context.find('#edit-workflow').drupalSetSummary(context => {
31         const vals = [];
32         $(context)
33           .find('input[name^="options"]:checked')
34           .next('label')
35           .each(function() {
36             vals.push(Drupal.checkPlain($(this).text()));
37           });
38         if (
39           !$(context)
40             .find('#edit-options-status')
41             .is(':checked')
42         ) {
43           vals.unshift(Drupal.t('Not published'));
44         }
45         return vals.join(', ');
46       });
47       $('#edit-language', context).drupalSetSummary(context => {
48         const vals = [];
49
50         vals.push(
51           $(
52             '.js-form-item-language-configuration-langcode select option:selected',
53             context,
54           ).text(),
55         );
56
57         $('input:checked', context)
58           .next('label')
59           .each(function() {
60             vals.push(Drupal.checkPlain($(this).text()));
61           });
62
63         return vals.join(', ');
64       });
65       $context.find('#edit-display').drupalSetSummary(context => {
66         const vals = [];
67         const $editContext = $(context);
68         $editContext
69           .find('input:checked')
70           .next('label')
71           .each(function() {
72             vals.push(Drupal.checkPlain($(this).text()));
73           });
74         if (!$editContext.find('#edit-display-submitted').is(':checked')) {
75           vals.unshift(Drupal.t("Don't display post information"));
76         }
77         return vals.join(', ');
78       });
79     },
80   };
81 })(jQuery, Drupal);