Skip to content

6.x extend: fixes and additions from porting craftcms/guest-entries - #792

Draft
lukeholder wants to merge 2 commits into
mainfrom
docs/6x-plugin-porting-fixes
Draft

lukeholder wants to merge 2 commits into
mainfrom
docs/6x-plugin-porting-fixes

Conversation

@lukeholder

Copy link
Copy Markdown
Member

Summary

Corrections and additions to the Craft 6.x extension docs, found by porting craftcms/guest-entries (Craft 5 to a native, adapter-free Craft 6 plugin) on craftcms/cms 6.0.0-alpha.20. Every change was checked against the installed source or by running the code.

The ported plugin is on the 5.x-via-skill branch of craftcms/guest-entries.

Changes

  • extend/provider.md
    • createSettings() is documented without its signature. It is protected static function createSettings(): ?PluginSettings; a copy of the old non-static createSettingsModel() signature is a fatal error.
    • Adds a warning that after switching to CraftCms\Cms\Plugin\Plugin, the adapter no longer routes actions/{handle}/… to the plugin (it only routes to Yii plugins). Yii controllers return a 404 until they are ported and routed in routes/actions.php, and settingsHtml() is replaced by settingsForm(). The current text says the plugin is "in a stable state" after the switch, which isn't true for plugins with controllers.
  • extend/session.md, extend/http.md: Auth::craftUser() does not exist (it throws SessionGuard::craftUser does not exist). Documents $request->craftUser() and the currentUser() / currentUserElement() helpers.
  • extend/http.md: new CSRF section: Laravel returns 419 without a token, and PreventRequestForgery::except() is the equivalent of disabling enableCsrfValidation on a Yii controller (Craft uses it for graphql/api).
  • extend/upgrade.md: PluginSettings extends Component, which has no attributes(), so a settings class that moves to it can't call parent::attributes().
  • extend/structure.md: new "Class Organization" section recommending a PascalCase namespace and Craft's own layout (Http/Controllers, Events, Data, Models, ...), with core examples.
  • Fixes broken links (approach.md, commands.md, config.md) and an unfinished comment in local-dev.md.

Not changed (needs a maintainer's call)

  • provider.md says not to add extra.laravel.providers; structure.md shows it as an option.
  • The mailer config file is config/mail.php in approach.md and config/mailer.php in mail.md.
  • The auth methods registry is AuthMethodCatalog in avenues.md and AuthMethods in registries.md.
  • extend/elements.md is an empty page.
  • Separately, a Craft bug (not docs): when plugin settings validation fails, PluginsController::saveSettings() throws a TypeError because it returns a CpScreenResponse where Response is declared.

🤖 Generated with Claude Code

lukeholder and others added 2 commits October 16, 2026 14:46
Verified against craftcms/cms 6.0.0-alpha.20 while porting a plugin:

- provider.md: createSettings() is static; warn that switching to
  CraftCms\Cms\Plugin\Plugin stops the adapter routing Yii controllers,
  and that settingsHtml() is replaced by settingsForm().
- session.md, http.md: Auth::craftUser() does not exist; use
  $request->craftUser() or the currentUser()/currentUserElement() helpers.
- http.md: document the CSRF opt-out (PreventRequestForgery::except()).
- upgrade.md: PluginSettings has no attributes() to call parent:: on.
- Fix broken links in approach.md, commands.md and config.md, and an
  unfinished comment in local-dev.md.
Adds a Class Organization section to structure.md, mirroring Craft core
(Http/Controllers, Events, Data, Models, ...), for plugins ported from Craft 5.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@netlify

netlify Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for craft-docs ready!

Name Link
🔨 Latest commit 27b375d
🔍 Latest deploy log https://app.netlify.com/projects/craft-docs/deploys/6ad1d53dccccda93c1f2abed
😎 Deploy Preview https://deploy-preview-792--craft-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

1 participant