Versions Compared

Key

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

...

Code Block
languagephp
title/plugins/my_plugin/my_plugin_plugin.php
linenumberstrue
<?php
class MyPluginPlugin extends Plugin {

    ...

    public function getActions() {
		return array(
			array(
				'action' => "nav_primary_client", // The action to tie into
				'uri' => "plugin/my_plugin/client_main/index/", // The URI to fetch when the action is needed
				'name' => "Foo Bar", // The name used by Blesta to display for the action (e.g. The name of the link),
				'options' => null, // Options required for this action if any (e.g. array('key' => "value"))
				'enabled' => 1 // Whether or not the action should be enabled by default (1 to enable, 0 to disable)
			)
		);
	}
}
?>

The above example would register the link "Foo Bar" in the client interface's primary navigation. The link would point to /plugin/my_plugin/client_main/index/. The URI resolves to the ClientMain controller and index method. Here's what that might look like:

...

Below is a list of all actions available.

ActionTypeDescriptionOptions
nav_primary_clientLinkRenders a link in the primary nav of the client interface
  • base_uri - (since version 4.0) The URI prepended to the value of the element's 'uri' attribute.
    If not provided, the base URI defaults to the base URI of the interface in which it displays–in this case, the client interface.
    Possible values include:
    • public - The base URI will be set to the URI of the public interface
    • client - The base URI will be set to the URI of the client interface
    • admin - The base URI will be set to the URI of the admin interface
    • Any other non-null value provided will be set as given (e.g. a custom URL: http://domain.com/)
  • sub - A numerical array of sub nav elements, each containing an array of:
    • uri - The URI to link to
    • name - The name of the link
    • icon - The icon to display (optional)
    • enabled - Whether the link is enabled by default (1 or 0, optional)
    • base_uri - (since version 4.0) The URI prepended to the value of the element's 'uri' attribute.
      If not provided, the base URI defaults to the base URI of the parent element.
      Possible values include:
      • public - The base URI will be set to the URI of the public interface
      • client - The base URI will be set to the URI of the client interface
      • admin - The base URI will be set to the URI of the admin interface
      • Any other non-null value provided will be set as given (e.g. a custom URL: http://domain.com/)
  • secondary - A numerical array of secondary nav elements, each containing an array of:
    • uri - The URI to link to
    • name - The name of the link
    • icon - The icon to display (optional)
    • enabled - Whether the link is enabled by default (1 or 0, optional)
    • base_uri - (since version 4.0) The URI prepended to the value of the element's 'uri' attribute.
      If not provided, the base URI defaults to the base URI of the parent element.
      Possible values include:
      • public - The base URI will be set to the URI of the public interface
      • client - The base URI will be set to the URI of the client interface
      • admin - The base URI will be set to the URI of the admin interface
      • Any other non-null value provided will be set as given (e.g. a custom URL: http://domain.com/)
nav_primary_staffLinkRenders a link in the primary nav of the admin interface
  • base_uri - (since version 4.0) The URI prepended to the value of the element's 'uri' attribute.
    If not provided, the base URI defaults to the base URI of the interface in which it displays–in this case, the admin interface.
    Possible values include:
    • public - The base URI will be set to the URI of the public interface
    • client - The base URI will be set to the URI of the client interface
    • admin - The base URI will be set to the URI of the admin interface
    • Any other non-null value provided will be set as given (e.g. a custom URL: http://domain.com/)
  • sub - A numerical array of sub nav elements, each containing an array of:
    • uri - The URI to link to
    • name - The name of the link
    • enabled - Whether the link is enabled by default (1 or 0, optional)
    • base_uri - (since version 4.0) The URI prepended to the value of the element's 'uri' attribute.
      If not provided, the base URI defaults to the base URI of the parent element.
      Possible values include:
      • public - The base URI will be set to the URI of the public interface
      • client - The base URI will be set to the URI of the client interface
      • admin - The base URI will be set to the URI of the admin interface
      • Any other non-null value provided will be set as given (e.g. a custom URL: http://domain.com/)
nav_secondary_staffLinkRenders a link in the secondary nav of the admin interface under the given parent
  • parent - The portion of the URI that identifies the primary nav element to place this under (e.g. "packages/" = Packages tab)
  • base_uri - (since version 4.0) The URI prepended to the value of the element's 'uri' attribute.
    If not provided, the base URI defaults to the base URI of the interface in which it displays–in this case, the admin interface.
    Possible values include:
    • public - The base URI will be set to the URI of the public interface
    • client - The base URI will be set to the URI of the client interface
    • admin - The base URI will be set to the URI of the admin interface
    • Any other non-null value provided will be set as given (e.g. a custom URL: http://domain.com/)
widget_client_homeWidgetRenders a widget on the client home pageN/A
widget_staff_homeWidgetRenders a widget on the staff home pageN/A
widget_staff_clientWidgetRenders a widget on the staff client profile pageN/A
widget_staff_billingWidgetRenders a widget on the staff billing pageN/A
action_staff_clientLinkRenders a link in the "Account Actions" section of the staff client profile page
  • class - The CSS class name to use to style the link