Skip to content

Commit

Permalink
lazyload
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Nov 14, 2023
1 parent 367b4cf commit 09c7b0d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion stanford_media.module
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ function stanford_media_preprocess_field(&$variables) {
/** @var \Drupal\media\OEmbed\UrlResolverInterface $url_resolver */
$url_resolver = \Drupal::service('media.oembed.url_resolver');
foreach ($variables['items'] as $delta => &$item) {
if (isset($item['content']['#attributes']['title'])) {
if (isset($item['content']['#attributes']['title']) || isset($item['content']['#iframe']['#attributes']['title'])) {
continue;
}

$url = $media->get($variables['field_name'])->get($delta)->getString();
if ($url && UrlHelper::isValid($url)) {
if (isset($item['content']['#iframe'])) {
Expand Down

0 comments on commit 09c7b0d

Please sign in to comment.