all video embeds are removed from Teasers

Created on 2 March 2024, 4 months ago
Updated 2 April 2024, 2 months ago

Problem/Motivation

I have many blog posts that include video embeds at the top, that I want to appear in the trimmed version. Other types of media (documents, images) do appear within the trimmed post, but video content (both local and remote) just gets skipped over, but text from after the video does show up in the trimmed version.

I would expect that the video(s) would appear in the trimmed / Teaser if the text after appears in it.

Using Drupal 10.2.3 on Apache webserver, PHP 8.2.16.

Steps to reproduce

  1. Select a content type that has a body filed type "Text (formatted, long, with summary)" and create a new node
  2. Embed a video near the top of the new node body, remote or local or both.
  3. Add some text after the video(s) and save.
  4. Look at the Teaser view -- e.g. in a View or Teaser preview. The video content will have been removed but the text after it may be in the Teaser, depending on how many characters the trimmed limit is set to.

Remote video like this is removed:

<drupal-media data-entity-type="media" data-entity-uuid="c88d434d-9776-4635-80e9-4747746e4336">&nbsp;</drupal-media>

And local video like this is also removed:

<drupal-media data-entity-type="media" data-entity-uuid="920e4c52-ff87-4607-95e8-c9cd5fdca44b">&nbsp;</drupal-media>

Oddly, the trimmed HTML includes this wrapper around the missing videos (remote first, then local):

<div>
            <div class="field field--name-field-media-oembed-video field--type-string field--label-hidden field--item">
</div>
</div>
<div>
  
  
  <div class="field field--name-field-media-video-file-1 field--type-file field--label-visually_hidden">
    <div class="field--label sr-only">Video file</div>
              <div class="field--item">
      
  
</div>
          </div>

</div>

@ressa confirms the issue at https://www.drupal.org/forum/support/post-installation/2024-02-27/choose... β†’

Proposed resolution

Expected behavior: Video media elements that are included in the body should appear in the Teaser / trimmed output, subject to the trimmed length limit.

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
TextΒ  β†’

Last updated 9 days ago

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @leeksoup
  • πŸ‡ΊπŸ‡ΈUnited States cilefen

    This occurs in the text_summary function in the text module. It depends on a format passed to it so I would look at its callers. I haven't done a deep look but this may be the intended behavior rather than a bug, although of course it could be changed. Or, it's a bug.

  • πŸ‡¦πŸ‡ΊAustralia pameeela

    Confirmed this occurs but interestingly the video remains if you use the Smart trim β†’ formatter.

Production build 0.69.0 2024