Skip to content

Port to Craft 6 (native, adapter-free) via craft-6-plugin-porting skill - #94

Draft
lukeholder wants to merge 1 commit into
4.xfrom
5.x-via-skill-v2
Draft

lukeholder wants to merge 1 commit into
4.xfrom
5.x-via-skill-v2

Conversation

@lukeholder

Copy link
Copy Markdown
Member

Summary

Ports Guest Entries to Craft 6 as a fully native plugin. It does not require craftcms/yii2-adapter.

  • Requires craftcms/cms ^6.0.0 and PHP ^8.5.
  • Moves to the CraftCms\GuestEntries namespace with Laravel-style folders (Http/Controllers, Events, Data).
  • Native Plugin base class, PluginSettings with a property hook, and settingsForm() replacing the Twig settings template.
  • SaveController is now an invokable class routed from routes/actions.php, so actions/guest-entries/save is unchanged.
  • Yii events and SaveEvent are replaced by SavingGuestEntry, SavedGuestEntry and GuestEntrySaveFailed (clean break, no compatibility layer).
  • Removes the two legacy settings migrations. The plugin has no tables.
  • Adds UPGRADE.md and updates the README for the Craft 6 form idioms (old(), errors, session()).

Testing

Tested in a Craft 6.0.0-alpha.20 host with no adapter and no yiisoft/yii2:

  • install, uninstall and reinstall
  • settings page render and save
  • front-end form round trip (failed post, successful post, redirect object templates)
  • Ajax responses (200, 400)
  • CSRF on (419 without a token) and off (200)
  • events on the normal, rejected, spam and failed paths, using throwaway listeners

Not verified / follow-ups

  • PHPStan was not run. ecs.php, phpstan.neon, the dev dependencies and .github/workflows/ci.yml still target Craft 4/5.
  • Custom-field error keys (for example errors.get('fields.body')) are not tested.
  • A settings save that fails validation was not re-checked (a known alpha TypeError in Craft).
  • The 5.x branch already contains a separate Craft 6 port and conflicts with this branch, so this PR targets 4.x.

🤖 Generated with Claude Code

- Require craftcms/cms ^6.0.0 and PHP ^8.5; no craftcms/yii2-adapter
- Move to CraftCms\GuestEntries namespace with Laravel-style folders
- Native Plugin base class, PluginSettings, and settingsForm()
- Invokable SaveController routed from routes/actions.php
- Replace Yii events with SavingGuestEntry, SavedGuestEntry and GuestEntrySaveFailed
- Remove legacy settings migrations and Twig settings template
- Add UPGRADE.md and update README for Craft 6

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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