Skip to Content search facebook instagram pinterest twitter youtube

Front-end entrance (tool pages)

A controller can provide methods to be used by tool pages; such controllers implement the FrontEndEntrance interface.

The controller needs to be registered so that it's selectable for use on tool pages. The second argument is a human-friendly name which is displayed in the admin UI:


Register::frontEndController('SproutModules\\Karmabunny\\MyModule\\Controllers\\MyController', 'Cool thing which does stuff');

To add a tool page via the admin, you select the 'module' (which is actually the controller), and the 'option' (one of the elements of the array returned by _getEntranceArguments).

The code for the controller itself should look something like this:


class MyController extends Controller implements FrontEndEntrance
    public function _getEntranceArguments()
        return ['doTheThing' => 'Do the thing'];
    public function entrance($argument)
        $entrances = $this->_getEntranceArguments();
        if (isset($entrances[$argument])) {
            Navigation::setPageNodeMatcher(new TreenodeRedirectMatcher($argument));
        // Failure
    public function doTheThing()
        // TODO: implement

The code in the entrance method can actually do whatever you want, but it's usually used to call internal methods or redirect elsewhere.

The Navigation::setPageNodeMatcher call tells the rest of the system which part of the menu is active, to highlight in the sidebar, show breadcrumbs, etc.