3 * Defines Javascript behaviors for the node module.
6 (function ($, Drupal, drupalSettings) {
11 * Behaviors for tabs in the node edit form.
13 * @type {Drupal~behavior}
15 * @prop {Drupal~behaviorAttach} attach
16 * Attaches summary behavior for tabs in the node edit form.
18 Drupal.behaviors.nodeDetailsSummaries = {
19 attach: function (context) {
20 var $context = $(context);
22 $context.find('.node-form-author').drupalSetSummary(function (context) {
23 var $authorContext = $(context);
24 var name = $authorContext.find('.field--name-uid input').val();
25 var date = $authorContext.find('.field--name-created input').val();
28 return Drupal.t('By @name on @date', {'@name': name, '@date': 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(function (context) {
39 var $optionsContext = $(context);
42 if ($optionsContext.find('input').is(':checked')) {
43 $optionsContext.find('input:checked').next('label').each(function () {
44 vals.push(Drupal.checkPlain($.trim($(this).text())));
46 return vals.join(', ');
49 return Drupal.t('Not promoted');
55 })(jQuery, Drupal, drupalSettings);