3 * Defines Javascript behaviors for the node module.
6 (function($, Drupal, drupalSettings) {
8 * Behaviors for tabs in the node edit form.
10 * @type {Drupal~behavior}
12 * @prop {Drupal~behaviorAttach} attach
13 * Attaches summary behavior for tabs in the node edit form.
15 Drupal.behaviors.nodeDetailsSummaries = {
17 const $context = $(context);
19 $context.find('.node-form-author').drupalSetSummary(context => {
20 const $authorContext = $(context);
21 const name = $authorContext.find('.field--name-uid input').val();
22 const date = $authorContext.find('.field--name-created input').val();
25 return Drupal.t('By @name on @date', {
31 return Drupal.t('By @name', { '@name': name });
34 return Drupal.t('Authored on @date', { '@date': date });
38 $context.find('.node-form-options').drupalSetSummary(context => {
39 const $optionsContext = $(context);
42 if ($optionsContext.find('input').is(':checked')) {
44 .find('input:checked')
47 vals.push(Drupal.checkPlain($.trim($(this).text())));
49 return vals.join(', ');
52 return Drupal.t('Not promoted');
56 })(jQuery, Drupal, drupalSettings);