fix: notice Attribut im MFormParameterHandler ergänzt - #394
Conversation
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Moin WalkthroughDie Änderung erweitert den Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 Minuten Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR closes the remaining gap so the notice attribute can be passed via the parameter array (e.g. in addMediaField, addLinkField, etc.) by adding notice handling to MFormParameterHandler, consistent with existing handling for label and full.
Changes:
- Add
noticecase toMFormParameterHandler::addParameter()to map toMFormItem::setNotice()
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $item->setFull(true); | ||
| break; | ||
| case 'notice': | ||
| $item->setNotice($value); |
There was a problem hiding this comment.
MFormItem::setNotice() expects a string, but MFormParameterHandler::addParameter() forwards $value as mixed. If callers pass null/array/object in the parameter array, this will raise a TypeError. Consider normalizing here (e.g., treat null as '' and cast scalars to string, or validate and throw a clearer exception).
| $item->setNotice($value); | |
| if ($value === null) { | |
| $normalizedNotice = ''; | |
| } elseif (is_scalar($value) || (is_object($value) && method_exists($value, '__toString'))) { | |
| $normalizedNotice = (string) $value; | |
| } else { | |
| throw new \InvalidArgumentException( | |
| 'MFormParameterHandler::addParameter(): parameter "notice" must be stringable, ' . gettype($value) . ' given' | |
| ); | |
| } | |
| $item->setNotice($normalizedNotice); |
Problem
Das
noticeAttribut konnte nicht über den Parameter-Array übergeben werden (z.B. beiaddMediaField,addTextFieldetc.), obwohllabelundfullbereits unterstützt wurden.Lösung
notice-Case imMFormParameterHandlerergänzt – analog zulabelundfull.Verwendung
Hinweis
Die restliche Implementation (
MFormItem,MFormElement,MFormAttributeHandler,MFormParser, Fragmentmform_default.php) war bereits vollständig vorhanden. Dieser Fix schließt die letzte fehlende Lücke.Closes #389
Summary by CodeRabbit
Neue Funktionen