Repository navigation
Conversation
Brings the {form}/{input}/{label} deprecation to {control} via the
shared TagParser::consumeCommaBeforeArguments() helper. Triggers
E_USER_DEPRECATED when a token follows the name (and optional :method)
without a separating comma, pointing to the offending column; the tag
still compiles. A trailing |modifier is not mistaken for arguments.
Two forward-compatible additions to the classic presenter form: - The form owns its cross-origin state (private ?FetchSite $allowedOrigin + allowCrossOrigin()) instead of relying on the protected $crossOrigin inherited from Nette\Forms\Form. Forms 3.x declares that property untyped while 4.0 removes it, so no redeclaration can satisfy both; a differently named private property works with either version. - createDefaultSource() returns null, which under forms 4.0 prevents the lazy default HttpSource from materializing (the form is anchored via the presenter). Under 3.x the method is unused; its return type references an interface that only exists in 4.0, which is safe because without a parent method there is no variance check. The classic receiveHttpData()/isAnchored()/beforeRender() overrides double as the documented BC seam of forms 4.0, so a single class works with both major versions.
The form no longer overrides receiveHttpData(), isAnchored() and beforeRender(); instead it overrides createDefaultSource() to return null and sets the @internal FormSubmissionSource when anchored to a presenter. The source detects submission via the 'submit' signal, reads the application request and installs the hidden signal field in its prepare() render hook; it resolves the presenter from the form lazily, so a form re-anchored to another presenter keeps working. The catch-up pass of setSubmissionSource() replaces the manual loadHttpData() loop in validateParent(). The form owns its cross-origin state (private ?FetchSite $allowedOrigin + allowCrossOrigin()) independently of nette/forms; the same-origin check intentionally stays in signalReceived(), where a failure is reported via Presenter::detectedCsrf(). Requires nette/forms 4.0.
Persistent, action, render and signal parameters can be typed as a backed enum. The URL carries the case value: link() unwraps BackedEnum instances before the URL is built (http_build_query would otherwise decompose the object into an array), and incoming scalars are losslessly converted back via tryFrom(); an invalid value yields 4xx, not 500.
…e() for persistent parameters. [Closes nette/nette#703][Closes nette/nette#703][Closes nette#69]" (possible BC break) This reverts commit cda17f4. See https://forum.nette.org/cs/35528-stejne-pojmenovany-parametr-akce-presenteru-a-persistentni-odlisne-chovani-v-nette-2-0-oproti-aktualnimu#p221742 BC break: Property must be nullable, ie: #[Persistent] public ?int $foo
…ame>() methods (BC break)
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.
The class_exists() check is redundant because is_a() with allow_string: true already verifies that the given class exists and is compatible with Template.
The same is_a() check is already used in createTemplate(), so this change also makes the validation consistent within TemplateFactory.