Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/cms 660 show read-only settings when allowAdminChanges is disabled #16265

Open
wants to merge 27 commits into
base: 5.6
Choose a base branch
from

Conversation

i-just
Copy link
Contributor

@i-just i-just commented Dec 3, 2024

Description

Shows read-only settings when allowAdminChanges is disabled.

  • switched .revision-notice to a generic .content-notice class so that the styles can be reused for other purposes too
  • when admin changes are disallowed, the “Settings” main nav item and all the subpages (except for the plugin settings) are shown, with all the fields and forms being disabled and with a notice at the top of every page
  • plugins can opt into having their settings shown when allowAdminChanges is disabled; to do so, they need to ensure none of the settings are editable in such case and implement public function canViewReadOnlySettings(): bool; to return true
  • src/events/RegisterCpSettingsEvent has a new public property $readOnlyModeReady, which is set to false by default; if the settings changes manipulated via the event are ready to be displayed in a non-editable way, set it to true to have them show when admin changes are not allowed.
Screenshot 2024-12-06 at 07 47 21

Related issues

cms-660

Copy link

linear bot commented Dec 3, 2024

@Mosnar
Copy link
Contributor

Mosnar commented Dec 4, 2024

Love this! It might be worth adding a "Learn More" button to a KB article explaining why settings can't/shouldn't be changed in production. Newer Craft developers or over-confident clients might read the current disclaimer as instructions to simply turn on "allowAdminChanges" and potentially get themselves in a mess.

@i-just i-just marked this pull request as ready for review December 4, 2024 14:36
Copy link
Contributor

@gcamacho079 gcamacho079 left a comment

Choose a reason for hiding this comment

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

@i-just awesome! I pinged you on the Notion page for this feature as I had some follow-up questions.

@i-just
Copy link
Contributor Author

i-just commented Dec 9, 2024

thanks @gcamacho079! I actioned all your comments. Extra info on the Notion page. LMK if anything doesn't make sense.

@gcamacho079
Copy link
Contributor

Thanks for knocking out those changes, @i-just! A couple more things I noticed that should also get the disabled attribute:

  • The .menubtn for “Selectable {{ element }} condition” on Entries and Assets field settings pages
  • The “Static Rows” field (and the conditionally-revealed fields) on Table field settings
  • Info toggle buttons inside disabled table fields (for example, in the “Site Settings” table heading on the Matrix field settings page)

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.

4 participants