messages.js 1.1 KB

123456789101112131415161718192021222324252627
  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.theme.message = function (_ref, _ref2) {
  9. var text = _ref.text;
  10. var type = _ref2.type,
  11. id = _ref2.id;
  12. var messagesTypes = Drupal.Message.getMessageTypeLabels();
  13. var messageWrapper = document.createElement('div');
  14. messageWrapper.setAttribute('class', 'messages messages--' + type);
  15. messageWrapper.setAttribute('role', type === 'error' || type === 'warning' ? 'alert' : 'status');
  16. messageWrapper.setAttribute('aria-labelledby', id + '-title');
  17. messageWrapper.setAttribute('data-drupal-message-id', id);
  18. messageWrapper.setAttribute('data-drupal-message-type', type);
  19. messageWrapper.innerHTML = '\n <div class="messages__header">\n <h2 id="' + id + '-title" class="messages__title">\n ' + messagesTypes[type] + '\n </h2>\n </div>\n <div class="messages__content">\n ' + text + '\n </div>\n ';
  20. return messageWrapper;
  21. };
  22. })(Drupal);