Soma Posted January 15, 2014 Share Posted January 15, 2014 Just wrote a new tutorial! Instead of writing it down here I did it on my recently created new blog. http://soma.urlich.ch/posts/create-a-helper-module-for-processwire/ 10 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted January 15, 2014 Share Posted January 15, 2014 Was thinking the same. Nice to see you pick this up. ( not much time here these days, still working ) I totally misread your post. ( Think better go to bed ) Link to comment Share on other sites More sharing options...
ryan Posted January 18, 2014 Share Posted January 18, 2014 Great tutorial Soma! Thanks for making it. One thing I wanted to mention is that this syntax: wire("fuel")->set("helper", $this); has been replaced by this syntax: wire('helper', $this); // or this: $this->wire('helper', $this); But of course your tutorial is correct in using 'fuel' since it would be compatible with past versions of ProcessWire too. Just wanted to mention it since I think the API is simpler if all getting or setting of API variables is just done through the wire() or $this->wire() functions. But the old syntax will always continue to work as 'fuel' is itself an API variable, but one that I figured makes more sense as an internal-only API variable. 3 Link to comment Share on other sites More sharing options...
Pete Posted January 18, 2014 Share Posted January 18, 2014 Cool - I didn't even know about being able to set variables like that! Link to comment Share on other sites More sharing options...
Nuwanda Posted July 24, 2015 Share Posted July 24, 2015 Hi, Ryan, Soma Just tried out Soma's original code with PW 2.5.1 and the old call to... wire("fuel")->set("helper", $this); ...failed: call to non-object. It worked with the updated code. So the old call is not backwards compatible any longer? Great tutorial Soma! Thanks for making it. One thing I wanted to mention is that this syntax: wire("fuel")->set("helper", $this); has been replaced by this syntax: wire('helper', $this); // or this: $this->wire('helper', $this); But of course your tutorial is correct in using 'fuel' since it would be compatible with past versions of ProcessWire too. Just wanted to mention it since I think the API is simpler if all getting or setting of API variables is just done through the wire() or $this->wire() functions. But the old syntax will always continue to work as 'fuel' is itself an API variable, but one that I figured makes more sense as an internal-only API variable. 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