Initial Drupal 11 with DDEV setup
This commit is contained in:
		
							
								
								
									
										40
									
								
								web/core/modules/media/js/form.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								web/core/modules/media/js/form.js
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,40 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @file
 | 
			
		||||
 * Defines JavaScript behaviors for the media form.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
(function ($, Drupal) {
 | 
			
		||||
  /**
 | 
			
		||||
   * Behaviors for summaries for tabs in the media edit form.
 | 
			
		||||
   *
 | 
			
		||||
   * @type {Drupal~behavior}
 | 
			
		||||
   *
 | 
			
		||||
   * @prop {Drupal~behaviorAttach} attach
 | 
			
		||||
   *   Attaches summary behavior for tabs in the media edit form.
 | 
			
		||||
   */
 | 
			
		||||
  Drupal.behaviors.mediaFormSummaries = {
 | 
			
		||||
    attach(context) {
 | 
			
		||||
      $(context)
 | 
			
		||||
        .find('.media-form-author')
 | 
			
		||||
        .drupalSetSummary((context) => {
 | 
			
		||||
          const nameInput = context.querySelector('.field--name-uid input');
 | 
			
		||||
          const name = nameInput?.value;
 | 
			
		||||
          const dateInput = context.querySelector('.field--name-created input');
 | 
			
		||||
          const date = dateInput?.value;
 | 
			
		||||
 | 
			
		||||
          if (name && date) {
 | 
			
		||||
            return Drupal.t('By @name on @date', {
 | 
			
		||||
              '@name': name,
 | 
			
		||||
              '@date': date,
 | 
			
		||||
            });
 | 
			
		||||
          }
 | 
			
		||||
          if (name) {
 | 
			
		||||
            return Drupal.t('By @name', { '@name': name });
 | 
			
		||||
          }
 | 
			
		||||
          if (date) {
 | 
			
		||||
            return Drupal.t('Authored on @date', { '@date': date });
 | 
			
		||||
          }
 | 
			
		||||
        });
 | 
			
		||||
    },
 | 
			
		||||
  };
 | 
			
		||||
})(jQuery, Drupal);
 | 
			
		||||
							
								
								
									
										19
									
								
								web/core/modules/media/js/media_embed_ckeditor.theme.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								web/core/modules/media/js/media_embed_ckeditor.theme.js
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @file
 | 
			
		||||
 * Theme elements for the Media Embed text editor plugins.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
((Drupal) => {
 | 
			
		||||
  /**
 | 
			
		||||
   * Themes the error displayed when the media embed preview fails.
 | 
			
		||||
   *
 | 
			
		||||
   * @return {string}
 | 
			
		||||
   *   A string representing a DOM fragment.
 | 
			
		||||
   *
 | 
			
		||||
   * @see media-embed-error.html.twig
 | 
			
		||||
   */
 | 
			
		||||
  Drupal.theme.mediaEmbedPreviewError = () =>
 | 
			
		||||
    `<div>${Drupal.t(
 | 
			
		||||
      'An error occurred while trying to preview the media. Save your work and reload this page.',
 | 
			
		||||
    )}</div>`;
 | 
			
		||||
})(Drupal);
 | 
			
		||||
							
								
								
									
										56
									
								
								web/core/modules/media/js/type_form.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								web/core/modules/media/js/type_form.js
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,56 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @file
 | 
			
		||||
 * Defines JavaScript behaviors for the media type form.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
(function ($, Drupal) {
 | 
			
		||||
  /**
 | 
			
		||||
   * Behaviors for setting summaries on media type form.
 | 
			
		||||
   *
 | 
			
		||||
   * @type {Drupal~behavior}
 | 
			
		||||
   *
 | 
			
		||||
   * @prop {Drupal~behaviorAttach} attach
 | 
			
		||||
   *   Attaches summary behaviors on media type edit forms.
 | 
			
		||||
   */
 | 
			
		||||
  Drupal.behaviors.mediaTypeFormSummaries = {
 | 
			
		||||
    attach(context) {
 | 
			
		||||
      const $context = $(context);
 | 
			
		||||
      // Provide the vertical tab summaries.
 | 
			
		||||
      $context.find('#edit-workflow').drupalSetSummary((context) => {
 | 
			
		||||
        const values = [];
 | 
			
		||||
        $(context)
 | 
			
		||||
          .find('input[name^="options"]:checked')
 | 
			
		||||
          .parent()
 | 
			
		||||
          .each(function () {
 | 
			
		||||
            values.push(
 | 
			
		||||
              Drupal.checkPlain($(this).find('label')[0].textContent),
 | 
			
		||||
            );
 | 
			
		||||
          });
 | 
			
		||||
        if ($(context).find('#edit-options-status:checked').length === 0) {
 | 
			
		||||
          values.unshift(Drupal.t('Not published'));
 | 
			
		||||
        }
 | 
			
		||||
        return values.join(', ');
 | 
			
		||||
      });
 | 
			
		||||
      $(context)
 | 
			
		||||
        .find('#edit-language')
 | 
			
		||||
        .drupalSetSummary((context) => {
 | 
			
		||||
          const values = [];
 | 
			
		||||
 | 
			
		||||
          values.push(
 | 
			
		||||
            $(context).find(
 | 
			
		||||
              '.js-form-item-language-configuration-langcode select option:selected',
 | 
			
		||||
            )[0].textContent,
 | 
			
		||||
          );
 | 
			
		||||
 | 
			
		||||
          $(context)
 | 
			
		||||
            .find('input:checked')
 | 
			
		||||
            .next('label')
 | 
			
		||||
            .each(function () {
 | 
			
		||||
              values.push(Drupal.checkPlain(this.textContent));
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
          return values.join(', ');
 | 
			
		||||
        });
 | 
			
		||||
    },
 | 
			
		||||
  };
 | 
			
		||||
})(jQuery, Drupal);
 | 
			
		||||
		Reference in New Issue
	
	Block a user