Component

Media

Some extra's for media components.

 

Better classes

The classes on taxonomy-terms has been changed to:

{%
  set classes = [
    'media',
    'media--' ~ elements['#media'].bundle()|clean_class,
    elements['#view_mode'] ? 'media--' ~ elements['#media'].bundle()|clean_class ~ '--' ~ elements['#view_mode']|clean_class,
    not elements['#media'].isPublished() ? 'media--unpublished',
  ]
%}

Which gives you the following classes:

.media {}
.media--file {}
.media--file--teaser {}
.media--unpublished {} 

 

Extra functions

Create the possibility to have media-type-specific preprocess functions.

So inside media--file.theme you could now have this function:

<?php

/**
 * Implements template_preprocess_hook().
 */
function compony_preprocess_media__file(&$variables, $hook) {
  // Do custom preprocessing here, 
  // only for media files. 
}

(Docs: Extending hooks yourself)

media
Drupal Core
Responsive
Accessible
HTML
19 downloads
horizontal beam No open issue