Repository navigation
6.x extend: fixes and additions from porting craftcms/guest-entries - #792
Draft
lukeholder wants to merge 2 commits into
Draft
lukeholder wants to merge 2 commits into
lukeholder wants to merge 2 commits into
Conversation
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>
✅ Deploy Preview for craft-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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) oncraftcms/cms6.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-skillbranch ofcraftcms/guest-entries.Changes
extend/provider.mdcreateSettings()is documented without its signature. It isprotected static function createSettings(): ?PluginSettings; a copy of the old non-staticcreateSettingsModel()signature is a fatal error.CraftCms\Cms\Plugin\Plugin, the adapter no longer routesactions/{handle}/…to the plugin (it only routes to Yii plugins). Yii controllers return a 404 until they are ported and routed inroutes/actions.php, andsettingsHtml()is replaced bysettingsForm(). 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 throwsSessionGuard::craftUser does not exist). Documents$request->craftUser()and thecurrentUser()/currentUserElement()helpers.extend/http.md: new CSRF section: Laravel returns 419 without a token, andPreventRequestForgery::except()is the equivalent of disablingenableCsrfValidationon a Yii controller (Craft uses it forgraphql/api).extend/upgrade.md:PluginSettingsextendsComponent, which has noattributes(), so a settings class that moves to it can't callparent::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.approach.md,commands.md,config.md) and an unfinished comment inlocal-dev.md.Not changed (needs a maintainer's call)
provider.mdsays not to addextra.laravel.providers;structure.mdshows it as an option.config/mail.phpinapproach.mdandconfig/mailer.phpinmail.md.AuthMethodCataloginavenues.mdandAuthMethodsinregistries.md.extend/elements.mdis an empty page.PluginsController::saveSettings()throws aTypeErrorbecause it returns aCpScreenResponsewhereResponseis declared.🤖 Generated with Claude Code