Jump to content

Module install() $this->registerHook() OR vs. AND


justinl
 Share

Recommended Posts

Hello,

I've just started developing with Prestashop and writing my own modules. One question that comes to mind is what is the difference or purpose to using OR or AND when writing the install() method of a module.

Consider these two code snippets:

function install()
   {
       if (!parent::install() OR !$this->registerHook('top') OR !$this->registerHook('header'))
           return false;
       return true;
   }



public function install()
   {
           return (parent::install() AND $this->registerHook('top') AND $this->registerHook('header'));
   }



What is the purpose of using AND or OR? What do they do? All I can figure out is that if you use AND, it installs your module by default into those hooks. Any light shed on this or a link to some documentation would be much appreciated.

Thanks

Share this post


Link to post
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

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More