Provide option to display contextual links on embedded entities

Created on 1 October 2020, about 4 years ago
Updated 27 January 2023, almost 2 years ago

Problem/Motivation

The Media Embed filter plugin currently removes contextual links from embedded media. The code mentions:

// - Contextual Links do not make sense for embedded entities; we only allow
//   the host entity to be contextually managed.

However, I think the ability to contextually manage items is exactly why I'd rather embed media than insert an image directly in my content. For example, I could have an "Attribution" field on an image bundle, and want to provide users the ability to edit that attribution wherever that image appears. Same idea with some image style implementations that use cropping, if you are editing content, and see a weird crop in an embedded image, it's a much better UX to edit the image in place, than to click over to the media library, brainstorm what title search might correspond to this image, page thru results...

Proposed resolution

Add a checkbox to the settings form for the Media Embed filter that allows users to opt in to contextual links on embedded media.

Remaining tasks

  1. Write tests? (not my forte)

User interface changes

New option on Media Embed filter settings form, defaulting to current behavior.

✨ Feature request
Status

Needs work

Version

10.1 ✨

Component
MediaΒ  β†’

Last updated about 22 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States xaqrox Washington, D.C.

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

  • Needs subsystem maintainer review

    It is used to alert the maintainer(s) of a particular core subsystem that an issue significantly impacts their subsystem, and their signoff is needed (see the governance policy draft for more information). Also, if you use this tag, make sure the issue component is set to the correct subsystem. If an issue significantly impacts more than one subsystem, use needs framework manager review instead.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request β†’ as a guide.

    Tagging for tests as that will need to happen.
    But also tagging for subsystem review as they may have different thoughts about if this should be implemented.

  • πŸ‡©πŸ‡ͺGermany e.r.n.i.e

    I applied the patch #3 ✨ Provide option to display contextual links on embedded entities Needs work successfully (Drupal 10.1).

    πŸ‘ Thank you @xaqrox! This is an important UI improvement for my use cases.

  • πŸ‡©πŸ‡ͺGermany 4kant

    Patch #3 applied cleanly in D 9.5.10 and in D 10.1.5
    ThatΒ΄s exactly what I was looking for. Webmasters are now able to edit and therefore also to crop images...
    Thanks a lot @xaqrox!

  • First commit to issue fork.
  • Pipeline finished with Failed
    about 1 year ago
    Total: 509s
    #57525
  • Pipeline finished with Success
    about 1 year ago
    Total: 621s
    #57670
  • Status changed to Needs review about 1 year ago
  • πŸ‡»πŸ‡³Vietnam phthlaap

    Added tests and fix some issues of config.

  • Status changed to Needs work about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Still needs submaintainer review but relooking and seeing the schema change realize will need an upgrade path + tests

  • πŸ‡»πŸ‡³Vietnam phthlaap

    Tests already there. Can you help to suggest what is the upgrade path?

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    When making a schema change that would appear in config export an upgrade path needs to be included that will add that setting to existing sites, setting to null. Then a simple test for the upgrade path that
    - checks config doesn't exist
    - run updates
    - checks config now exists with default vlaue

  • πŸ‡»πŸ‡³Vietnam phthlaap

    Can you please help provide sample code in any module?
    Thanks.

  • Pipeline finished with Failed
    9 months ago
    Total: 167s
    #120457
  • Pipeline finished with Failed
    9 months ago
    Total: 191s
    #120479
  • Pipeline finished with Success
    9 months ago
    Total: 554s
    #120484
  • Pipeline finished with Success
    9 months ago
    Total: 492s
    #121609
  • Status changed to Needs review 9 months ago
  • Status changed to Needs work 9 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Left a comment.

  • First commit to issue fork.
  • Pipeline finished with Failed
    about 2 months ago
    Total: 176s
    #321205
  • Pipeline finished with Failed
    about 2 months ago
    Total: 227s
    #321206
  • Pipeline finished with Failed
    about 2 months ago
    Total: 154s
    #321209
  • Pipeline finished with Failed
    about 2 months ago
    Total: 130s
    #321215
  • Pipeline finished with Failed
    about 2 months ago
    Total: 225s
    #321217
  • Pipeline finished with Failed
    about 2 months ago
    Total: 186s
    #321218
  • Pipeline finished with Failed
    about 2 months ago
    Total: 174s
    #321226
  • Pipeline finished with Success
    about 2 months ago
    Total: 3164s
    #321680
  • πŸ‡ΊπŸ‡ΈUnited States trackleft2 Tucson, AZ πŸ‡ΊπŸ‡Έ

    I've updated the test to comply with the latest coding standards.
    I've moved the update function to a post_update.php file.
    I've add batch functionality to the update.

    I've tested that the update works locally and on an existing site by
    1. exporting text format config and looking at the media_embet format section and seeing missing key.
    2. running the update
    3. exporting text format config and looking at the media_embet format section and seeing key there.

  • πŸ‡ΊπŸ‡ΈUnited States trackleft2 Tucson, AZ πŸ‡ΊπŸ‡Έ

    Created draft change record feel free to edit or update. https://www.drupal.org/node/3483890 β†’

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    With the update hook will need it's own test case as well.

    Thanks

  • Pipeline finished with Canceled
    about 2 months ago
    Total: 84s
    #323346
  • Pipeline finished with Failed
    about 2 months ago
    Total: 141s
    #323347
  • Pipeline finished with Canceled
    about 2 months ago
    Total: 373s
    #323349
  • Pipeline finished with Canceled
    about 2 months ago
    Total: 203s
    #323357
  • Pipeline finished with Canceled
    about 2 months ago
    Total: 419s
    #323362
  • Pipeline finished with Canceled
    about 2 months ago
    Total: 117s
    #323369
  • Pipeline finished with Canceled
    about 2 months ago
    Total: 83s
    #323370
  • Pipeline finished with Canceled
    about 2 months ago
    Total: 83s
    #323372
  • Pipeline finished with Canceled
    about 2 months ago
    Total: 84s
    #323373
  • Pipeline finished with Failed
    about 2 months ago
    Total: 586s
    #323374
  • Pipeline finished with Failed
    about 2 months ago
    Total: 564s
    #323383
  • Pipeline finished with Failed
    about 2 months ago
    Total: 649s
    #323393
  • Pipeline finished with Canceled
    about 2 months ago
    Total: 84s
    #323426
  • Pipeline finished with Canceled
    about 2 months ago
    Total: 589s
    #323427
  • Pipeline finished with Canceled
    about 2 months ago
    Total: 86s
    #323447
  • Pipeline finished with Failed
    about 2 months ago
    Total: 200s
    #323448
  • Pipeline finished with Failed
    about 2 months ago
    Total: 522s
    #323451
  • Pipeline finished with Canceled
    about 2 months ago
    Total: 789s
    #323461
  • Pipeline finished with Failed
    about 2 months ago
    Total: 138s
    #323474
  • Pipeline finished with Canceled
    about 2 months ago
    Total: 475s
    #323489
  • Pipeline finished with Success
    about 2 months ago
    Total: 1375s
    #323559
  • πŸ‡ΊπŸ‡ΈUnited States trackleft2 Tucson, AZ πŸ‡ΊπŸ‡Έ

    Added a new fixture database and test for update following this guide https://www.drupal.org/docs/drupal-apis/update-api/writing-automated-upd... β†’

  • Pipeline finished with Failed
    about 2 months ago
    Total: 690s
    #323584
  • Pipeline finished with Canceled
    about 2 months ago
    Total: 623s
    #323598
  • Pipeline finished with Success
    about 2 months ago
    Total: 1003s
    #323603
  • Pipeline finished with Success
    about 2 months ago
    Total: 854s
    #323616
  • πŸ‡ΊπŸ‡ΈUnited States trackleft2 Tucson, AZ πŸ‡ΊπŸ‡Έ
  • Pipeline finished with Failed
    about 2 months ago
    Total: 659s
    #323657
  • Pipeline finished with Failed
    about 2 months ago
    Total: 730s
    #323703
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Left a comment on MR.

  • πŸ‡ΊπŸ‡ΈUnited States trackleft2 Tucson, AZ πŸ‡ΊπŸ‡Έ

    Not sure we need a full dump like this. This doesn't need to be unique to umami and could probably use one of the existing figures in system.

    The issue is that the standard recipe does not have a format that has a media_embed filter enabled.

    OK, I'll do it the hard way.

  • Pipeline finished with Failed
    about 2 months ago
    Total: 667s
    #330694
  • Pipeline finished with Failed
    about 2 months ago
    Total: 559s
    #330707
  • Pipeline finished with Failed
    about 2 months ago
    Total: 576s
    #330715
  • πŸ‡ΊπŸ‡ΈUnited States trackleft2 Tucson, AZ πŸ‡ΊπŸ‡Έ

    I've updated the database fixture to include just what is added into the database when the media module is enabled plus two text formats that have the media_embed filter enabled.

  • Pipeline finished with Success
    about 2 months ago
    Total: 754s
    #330723
  • The Needs Review Queue Bot β†’ tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide β†’ to find step-by-step guides for working with issues.

  • πŸ‡ΊπŸ‡ΈUnited States schiavone

    Updated the patch for version 10.3.10

  • πŸ‡ΊπŸ‡ΈUnited States trackleft2 Tucson, AZ πŸ‡ΊπŸ‡Έ

    Don't use the patch if you intend to use this module as there is currently no upgrade path for changing the config schema data type.

    If you do use the patch and then remove it, you should be able to fix your site configuration so that it matches the new schema by simply resaving the setting after updating the codebase.

  • Pipeline finished with Success
    30 days ago
    Total: 784s
    #347389
  • πŸ‡ΊπŸ‡ΈUnited States schiavone

    @trackleft2 The only difference between the updated patch in #34 and the patch in #3 is an update of the line number that sets the default setting to show the contextual link. So should the same apply to both patches? If there's a problem with updating the schema should we create an update?

  • πŸ‡ΊπŸ‡ΈUnited States trackleft2 Tucson, AZ πŸ‡ΊπŸ‡Έ

    @schiavone the main difference between the patch and the merge request is the core/modules/media/config/schema/media.schema.yml file, in which the data type is set to boolean which creates a small discrepancy in the active config for anyone who updates from the patch to the merge request.

    I haven't heard of creating an update for migrating from one version of a patch to another, so I wouldn't support that idea.

  • Pipeline finished with Success
    16 days ago
    Total: 516s
    #361390
  • πŸ‡ΊπŸ‡ΈUnited States trackleft2 Tucson, AZ πŸ‡ΊπŸ‡Έ

    Providing an updated patch without tests against the 11.x branch

Production build 0.71.5 2024