When using the core Media module and then use the Media widget to add some media to a node, Permissions by terms info is shown. Very strange. The media items do not have any field referencing a term that uses the permissions by term options. And the node itself also not. Where does this come from? See the attached screenshot.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ecvandenberg created an issue. See original summary.

ecvandenberg’s picture

Here are steps to reproduce:

  • Install a fresh Drupal site using the recommended project and composer:

    composer create-project drupal/recommended-project drupal --no-interaction
  • Enable the core modules Media and Media Library
  • Add the Permissions by term module with composer

    composer require 'drupal/permissions_by_term:^2.14'
  • Enable the Permissions by term module
  • Add to the content type Article a field within the category Reference of the type Media
  • Go to Manage Form display
  • Use for the new field the widget Media Library and save
  • Now add content of the type Article
  • Click the Add media button

Then you will see the Permission by term details three times. It should not be there!

robotjox’s picture

Version: 8.x-2.13 » 8.x-2.25

Confirmed and still an issue with 8.x-2.25

kris77’s picture

Me too...

silverham’s picture

Status: Active » Needs review
StatusFileSize
new1.18 KB

Attached patch updates isNodeEditForm() function to check if base form id is node_form instead of just the current path.

gargsuchi’s picture

I can confirm the above patch works for me. Thanks @silverham.

gargsuchi’s picture

The fails in the patch are not related to the changes in the patch.

silverham’s picture

Status: Needs review » Reviewed & tested by the community

Thanks @gargsuchi :-)

bigbaldy’s picture

Installed patch and it resolves the issue in the Media widget modal. It also resolves an issue where an edit page has a header with a search field. Permissions by Term info was also attaching itself to the search form.

jastraat’s picture

Also applies to 3.1.17 and resolves the issue. Can this be included with the next release?

jastraat’s picture

Version: 8.x-2.25 » 3.1.17

Updating the version

ecvandenberg’s picture

Weird...
I was wondering why I did not gave any feedback on the provided patch.
When I now check the specific website, it's not an issue anymore. No patch applied.
I checked, but do not hide it by CSS.
Drupal version 9.3.12 and PBT version 3.1.17.
Should I check with a fresh site? Just to get things clear.

bigbaldy’s picture

Version: 3.1.17 » 3.1.20
Status: Reviewed & tested by the community » Needs work

Issue isNodeEditForm() function is not good enough that was added in release 3.1.20 breaks the current patch for this issue. The issue still exists in release 3.1.20. So, marking this as needs work.

Thomas Bosviel made their first commit to this issue’s fork.

thomas bosviel’s picture

Status: Needs work » Needs review
StatusFileSize
new3.85 KB

Attached patch moves alterations of Permissions by term info in node form-specific hook.

pbouchereau’s picture

StatusFileSize
new3.83 KB

Patch #16 doesn't apply to version 3.1.22.
Just a re-roll.

Jeya sundhar made their first commit to this issue’s fork.

marcoliver’s picture

Assigned: Unassigned » marcoliver

marcoliver’s picture

Status: Needs review » Fixed

Merged! Will tag a new release shortly.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.