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', { '@name': name, '@date': date });
28 return Drupal.t('By @name', { '@name': name });
31 return Drupal.t('Authored on @date', { '@date': date });
35 $context.find('.node-form-options').drupalSetSummary((context) => {
36 const $optionsContext = $(context);
39 if ($optionsContext.find('input').is(':checked')) {
40 $optionsContext.find('input:checked').next('label').each(function () {
41 vals.push(Drupal.checkPlain($.trim($(this).text())));
43 return vals.join(', ');
46 return Drupal.t('Not promoted');
50 }(jQuery, Drupal, drupalSettings));