Hooks system: Difference between revisions

Jump to navigation Jump to search
m
Tag: 2017 source edit
Tag: 2017 source edit
Line 110: Line 110:


Note: one way to determine the name of contexts you are when you reach a part of code is to add this code in the PHP code:
Note: one way to determine the name of contexts you are when you reach a part of code is to add this code in the PHP code:
<syntaxHighlight lang="php">
print('Module context: '.join(',', $object->contextarray));
print('Module context: '.join(',', $object->contextarray));
</syntaxHighlight>


Note that the '''all''' context means you want your hook beeing executed whatever is the context. The '''main''' means you want your hook to be executed for any web page, and '''cli''' means in every Command Line script (even if you can't see this context keys in $object->contextarray).
Note that the '''all''' context means you want your hook beeing executed whatever is the context. The '''main''' means you want your hook to be executed for any web page, and '''cli''' means in every Command Line script (even if you can't see this context keys in $object->contextarray).

Navigation menu