-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Get ViewModel children by capture #5255
Get ViewModel children by capture #5255
Conversation
* @param bool $recursive search recursive through children, default true | ||
* @return array | ||
*/ | ||
public function getChildrenByCaptureTo($capture, $recursive = true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a BC break
So I don't add it to the interface? |
@jaapio correct |
* @param bool $recursive search recursive through children, default true | ||
* @return array | ||
*/ | ||
public function getChildrenByCaptureTo($capture, $recursive = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternate possibility: add a new interface, "RetrievableChildrenInterface" or similar, and have the ViewModel also implement that interface. That way we can combine the two interfaces (or have the ViewModelInterface extend it) in 3.0, and users can test for that interface prior to calling the method.
Sounds good, but before I start more modifications I would like to know if this will be merged any way. Because if you don't like our solution at all, it is better to close this pr. :-) |
@jaapio yes, I'll merge it after you make the changes. :) |
Get ViewModel children by capture
…/getChildrenByCapture Get ViewModel children by capture
We wanted to add new content to the page view model using a listener. But in the MvcEvent pass to the listeners the view model is always the complete layout ViewModel and not only the page content model. So we needed a way to get a ViewModel by it's location in the template.