Jump to content

Passing arguments to module function


nikola
 Share

Recommended Posts

How can I pass arguments from template to a function that resides in the module?

I'm making a new module and can't figure it out...

Normally if I use a function directly in template(s), I can do the following:

 echo function($1, $2, $, $4);

where $1, $2, $3, $4 are arguments passed to a function.

Link to comment
Share on other sites

In the module's hook function you can do something like this:

<?php
public function someCustomFunction( HookEvent $event ) {

// get page object
$page = $event->object;

// get first argument
$some_id = (int) $event->arguments[0];

// current language
$lang = $event->arguments[1];
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...