Jump to content

Create a helper module for ProcessWire to generate FontAwesome icon markup


Soma
 Share

Recommended Posts

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.

  • Like 3
Link to comment
Share on other sites

  • 1 year later...

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...