Skip to content

Add the “show unpermitted sections” lightswitch for Entry fields#16991

Closed
ThomasDeMarez wants to merge 2 commits intocraftcms:5.xfrom
ThomasDeMarez:5.x
Closed

Add the “show unpermitted sections” lightswitch for Entry fields#16991
ThomasDeMarez wants to merge 2 commits intocraftcms:5.xfrom
ThomasDeMarez:5.x

Conversation

@ThomasDeMarez
Copy link
Copy Markdown
Contributor

Description

As already implemented for the Asset field, this PR would add an extra field "Show unpermitted sections" to the Entry field's config. This way Sections can be hidden for users that do not have permission to view any Entries in specific Sections.

  • This implementation is setup in a non breaking way by enabling the setting by default.
  • The native Link field has also been updated to support this new setting.

Related issues

#887


Entry Field
Link field

Link Field
Link field

Copy link
Copy Markdown
Member

@brandonkelly brandonkelly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I like the idea, but I don’t think we should be doing this from BaseRelationField; it should be confined to craft\fields\Entries, similar to how Assets’ fields “Show unpermitted volumes” and “Show unpermitted files” settings are implemented. We also may want to split this up into two settings (like Assets fields) – “Show unpermitted sections” and “Show unpermitted entries”.

@ThomasDeMarez
Copy link
Copy Markdown
Contributor Author

ThomasDeMarez commented Apr 2, 2025

The reason I implemented this on BaseRelationField is so other plugins, like Solspace’s EventFieldType, could easily override the base function and introduce their own “Show unpermitted Events” lightswitch. It could also be reused for any other native Craft field that extends BaseRelationField.

If you’d still prefer to implement this specifically within craft\fields\Entries, I’m happy to move it there. Let me know what works best!

@brandonkelly
Copy link
Copy Markdown
Member

I still think it makes more sense to do it on the child classes, since these settings are dealing with things that are pretty element type-specific.

@ThomasDeMarez
Copy link
Copy Markdown
Contributor Author

Updated as requested.

brandonkelly added a commit that referenced this pull request Apr 7, 2025
…tted-sectionsentries-settings

“Show unpermitted sections/entries” settings

Resolves #16991
@brandonkelly
Copy link
Copy Markdown
Member

brandonkelly commented Apr 7, 2025

Thanks! Merged for Craft 5.7 via #17034.

@brandonkelly
Copy link
Copy Markdown
Member

Craft 5.7.0 is out with those new settings. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants