Access Points

Module access points let you register a special URL which can be accessed from the public facing site. For example you might want a third party site to access data without needing a login to the Admin Area.

To create a module access point, open your module info file (eg: mymodule_module.php) and define a method called subscribe_access_points(). The module info file is described in more detail in the article Creating a Module. The subscribe_access_points() method must return an array with each index set to the URL you wish to create. Here is an example of how this might look:

public function subscribe_access_points()
{
    return array('latest_requests'=>'get_latest_requests');
}

This code creates an access point with the URL /latest_requests and if your website address was http://mysite.com/ then the access point would be http://mysite.com/latest_requests.

The next part is to define the logic called by the access point, in the above example the request will look for the find_latest_requests() method and use it. The method should be declared as public and take a single parameter which contains the URI information. For example:

public function get_latest_requests($params)
{
    echo "There are no requests because I didn't look... sorry!";
}

The method parameter will be an array containing the URI information passed to the URL. For example if the access point was accessed by http://mysite.com/latest_requests/closed then the $pararms array would contain a single string called closed.

Access points do not have any corresponding view file so any return output will need to be supplied manually by using echo() or print() functions, generally this would be used to supply some kind of basic feedback or XML data.