path.es6.js 643 B

12345678910111213141516171819202122232425
  1. /**
  2. * @file
  3. * Attaches behaviors for the Path module.
  4. */
  5. (function ($, Drupal) {
  6. /**
  7. * Behaviors for settings summaries on path edit forms.
  8. *
  9. * @type {Drupal~behavior}
  10. *
  11. * @prop {Drupal~behaviorAttach} attach
  12. * Attaches summary behavior on path edit forms.
  13. */
  14. Drupal.behaviors.pathDetailsSummaries = {
  15. attach(context) {
  16. $(context).find('.path-form').drupalSetSummary((context) => {
  17. const path = $('.js-form-item-path-0-alias input').val();
  18. return path ?
  19. Drupal.t('Alias: @alias', { '@alias': path }) :
  20. Drupal.t('No alias');
  21. });
  22. },
  23. };
  24. }(jQuery, Drupal));