- Issue created by @thomas.frobieter
So.. we probably have multiple issues here. For reasons drowl_media/bundle_slideshow is not loaded, but its falsely defined twice, for bundle codument and bundle slideshow.
Furthermore the media document bundle styles are never loaded, because we check for the slideshow bundle.
function drowl_media_preprocess_media(array &$variables) { // Attach frontend libraries by bundle if(!empty($variables['elements']['#media'])){ $attachments['#attached']['library'][] = 'drowl_media/global'; $bundle = $variables['elements']['#media']->bundle(); if($bundle == 'document'){ $attachments['#attached']['library'][] = 'drowl_media/bundle_slideshow'; } if($bundle == 'remote_video' || $bundle == 'video'){ $attachments['#attached']['library'][] = 'drowl_media/bundle_video'; } if($bundle == 'slideshow'){ $attachments['#attached']['library'][] = 'drowl_media/bundle_slideshow'; } } }
@anybody documents should be fixed, the drowl_media/bundle_slideshow library is still not loaded, while the bundle is correct.
Ideas?
if($bundle == 'slideshow'){ $attachments['#attached']['library'][] = 'drowl_media/bundle_slideshow'; }
Ouh, found it -_-
Copy+paste issue, ALLE this libraries aren't loaded..
$attachments was accidentally copied from:
function drowl_media_page_attachments(array &$attachments) { $isAdminRoute = \Drupal::service('router.admin_context')->isAdminRoute(); if ($isAdminRoute) { $attachments['#attached']['library'][] = 'drowl_media/admin'; } }
while it needs to be $variables here..
function drowl_media_preprocess_media(array &$variables) { // Attach frontend libraries by bundle if(!empty($variables['elements']['#media'])){ $variables['#attached']['library'][] = 'drowl_media/global'; $bundle = $variables['elements']['#media']->bundle(); if($bundle == 'document'){ $variables['#attached']['library'][] = 'drowl_media/bundle_documents'; } if($bundle == 'remote_video' || $bundle == 'video'){ $variables['#attached']['library'][] = 'drowl_media/bundle_video'; } if($bundle == 'slideshow'){ $variables['#attached']['library'][] = 'drowl_media/bundle_slideshow'; } } }
@anybody please review! We should create a new release now.
- Status changed to Needs review
over 1 year ago 8:59am 15 June 2023 - Open on Drupal.org →Core: 10.0.7 + Environment: PHP 8.0 & MySQL 5.7last update
over 1 year ago Waiting for branch to pass - @anybody opened merge request.
- Status changed to Needs work
over 1 year ago 9:04am 15 June 2023 - 🇩🇪Germany Anybody Porta Westfalica
@thomas.frobieter please review and resolve the comments. Did you already test it?
Really dangerous bug... the IDE should have told, that the variable does not exist... mhm - Assigned to Anybody
- Status changed to Needs review
over 1 year ago 9:14am 15 June 2023 - Open on Drupal.org →Core: 10.0.7 + Environment: PHP 8.0 & MySQL 5.7last update
over 1 year ago Waiting for branch to pass - Issue was unassigned.
- Status changed to Fixed
over 1 year ago 9:31am 15 June 2023 Automatically closed - issue fixed for 2 weeks with no activity.