form.js 928 B

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * DO NOT EDIT THIS FILE.
  3. * See the following change record for more information,
  4. * https://www.drupal.org/node/2815083
  5. * @preserve
  6. **/
  7. (function ($, Drupal) {
  8. Drupal.behaviors.mediaFormSummaries = {
  9. attach: function attach(context) {
  10. var $context = $(context);
  11. $context.find('.media-form-author').drupalSetSummary(function (context) {
  12. var $authorContext = $(context);
  13. var name = $authorContext.find('.field--name-uid input').val();
  14. var date = $authorContext.find('.field--name-created input').val();
  15. if (name && date) {
  16. return Drupal.t('By @name on @date', {
  17. '@name': name,
  18. '@date': date
  19. });
  20. }
  21. if (name) {
  22. return Drupal.t('By @name', { '@name': name });
  23. }
  24. if (date) {
  25. return Drupal.t('Authored on @date', { '@date': date });
  26. }
  27. });
  28. }
  29. };
  30. })(jQuery, Drupal);