Ivan Gretsky Posted July 11, 2022 Share Posted July 11, 2022 Good day, @teppo! Hope you're doing fine. I am using Wireframe in everything I build now) And devs I collaborate with love it as it gives us a defined common ground. Thanks! We are using components a lot. Particularly for RM based content builder. And we often need to call some component-unique logic from the component view. I wish we could do it like we can in regular views: just calling a public method of component controller as a function (or a property). It doesn't seem to be a feature now. Could this be added? 1 Link to comment Share on other sites More sharing options...
teppo Posted July 11, 2022 Share Posted July 11, 2022 Good day, Ivan. Glad to hear that you're enjoying Wireframe ? 41 minutes ago, Ivan Gretsky said: And we often need to call some component-unique logic from the component view. I wish we could do it like we can in regular views: just calling a public method of component controller as a function (or a property). It doesn't seem to be a feature now. Could this be added? Could you clarify how you're calling such methods in case of regular views? You should be already able to access component class methods from a component view with $this->method_name, similar to they way you access controller class methods from regular views. Both Controller and Component base classes implement MethodPropsTrait, which enables this behaviour. But if you're looking for something along the lines of View::getController(), ComponentView didn't have a direct method for that. Pretty sure this was originally by design (to keep component views from becoming too complex), but I've added a similar method in latest version (0.26.0) just in case: ComponentView::getComponent(). 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now