Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagephp
class MyPlugin extends Plugin
{
...
	/**
     * Returns whether this plugin provides support for setting admin or client service tabs
     * @see Plugin::getAdminServiceTabs
     * @see Plugin::getClientServiceTabs
     *
     * @return bool True if the plugin supports service tabs, or false otherwise
     */
    public function allowsServiceTabs() 
	{
		return true;
    }
...
}

getAdminServiceTabs($service)

...

Code Block
languagephp
class MyPlugin extends Plugin 
{
...
    /**
     * Returns all tabs to display to a client when managing a service
     *
     * @param stdClass $service A stdClass object representing the selected package
     * @return array An array of tabs in the format of method => array where array contains:
     *  - name (required) The name of the link
     *  - icon (optional) use to display a custom icon
     *  - href (optional) use to link to a different URL
     *      Example: array('methodName' => "Title", 'methodName2' => "Title2")
     *      array('methodName' => array('name' => "Title", 'icon' => "icon"))
     */
    public function getClientServiceTabs(stdClass $service)
    {
        $this->view = new View();

		// Make the service available to the view
        $this->view->set('service', $service);

		// Load the view at /plugins/my_plugin/views/default/tab_two.pdt
        $this->view->setView('tab_two', 'MyPlugin.default');

		// Display a notice message on this tab page
		$this->setMessage('notice', 'This is a test tab');

		// Return the content of the view
        return $this->view->fetch();
    }
...
}