Skip to content

Document 5.4 features: PluralRules, EnumLabelTrait, FormHelper hidden, subcommand validation, enumOptions#8308

Open
dereuromark wants to merge 2 commits into
5.nextfrom
docs/5.4-feature-coverage
Open

Document 5.4 features: PluralRules, EnumLabelTrait, FormHelper hidden, subcommand validation, enumOptions#8308
dereuromark wants to merge 2 commits into
5.nextfrom
docs/5.4-feature-coverage

Conversation

@dereuromark
Copy link
Copy Markdown
Member

Summary

Documents several merged 5.next features that were missing from the 5.4 migration guide and from the relevant chapters.

Primary target was the new PluralRules::setRule() API (cakephp/cakephp PR 19454); while auditing the rest of the 5.next merge window I found four more gaps and bundled them in:

  • PluralRules::setRule() / resetRules() — register a custom Gettext plural rule for a locale whose built-in form is missing or differs from the layout used by the app's .po/.mo files. New "Customizing Plural Rules" subsection in the i18n chapter + 5.4 migration entry.
  • EnumLabelTrait + #[Label] attribute — default label() implementation that humanizes the case name and runs it through the translator, with per-case overrides via the new attribute. New subsection in orm/database-basics.md next to EnumLabelInterface + 5.4 migration entry.
  • FormHelper hidden default — wrapper around CSRF / FormProtection blocks now uses the HTML5 boolean hidden attribute instead of inline style="display:none;", so the default markup is strict-CSP compatible (no style-src 'unsafe-inline'). Updates the HTML output samples in views/helpers/form.md and adds an Added-in-5.4.0 note + a 5.4 migration entry covering selector compatibility for apps that styled the old wrapper.
  • Subcommand validationbin/cake i18n nonsense previously silently ran the parent I18nCommand; it now errors out with a list of available subcommands. New "Subcommand Validation" section in console-commands/commands.md + 5.4 migration entry under Console behavior changes.
  • FormHelper::enumOptions() made public — useful when the form is created without an entity context. Small example added to the Select Pickers section + 5.4 migration entry.

Out of scope

The Lock component (cakephp/cakephp PR 19370) is being documented separately in docs PR 8272, so it is intentionally not touched here.

Some other 5.next merges already have open docs PRs in flight (8291 for LoggedQuery::setRedactor(), 8305 for Table::findUnhydrated()), so they are likewise out of scope here.

Notes

  • vitepress build runs clean against the branch.
  • All new anchor links resolve against the generated section ids (#customizing-plural-rules, #enumlabeltrait-and-the-label-attribute, #subcommand-validation, #creating-select-pickers).

… default, subcommand validation, enumOptions

Adds docs and 5.4 migration guide entries for several 5.next merges:

- PluralRules::setRule() / resetRules() for custom Gettext plural rules.
- EnumLabelTrait + Label attribute for derived translated enum labels.
- FormHelper now wraps hidden CSRF / FormProtection blocks with the HTML5
  boolean hidden attribute instead of inline style display:none, so the
  default markup is strict-CSP compatible.
- CLI rejects unknown positional tokens after a parent command that has
  sibling subcommands, surfacing typos instead of silently dropping them.
- FormHelper::enumOptions() is now public for building select options from
  a backed enum without entity context.
Full detail is already on the linked Subcommand Validation section in the
console-commands docs, so the migration guide just needs to flag the
behavior change and point at it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant