You are here

function power_menu_plugin_get_handler_instance in Power Menu 7.2

Creates an instance for given handler configuration.

Parameters

array $handler: The handler definition.

Return value

The class instance which implements the PowerMenuHandlerInterface or FALSE if no instance created.

5 calls to power_menu_plugin_get_handler_instance()
power_menu_configuration_handler_form in ./power_menu.admin.inc
Gets the settings form from handler plugins.
power_menu_form_menu_edit_item_alter in ./power_menu.module
Implements hook_form_ID_alter().
power_menu_get_path in ./power_menu.module
Gets the system path for the current page.
power_menu_plugin_get_handler_instance_by_name in ./power_menu.module
Creates an instance for given handler name.
_power_menu_call_handler_function in ./power_menu.module
Helper function to call a function in all registred handler objects.

File

./power_menu.module, line 332

Code

function power_menu_plugin_get_handler_instance($handler) {
  $class_name = ctools_plugin_get_class($handler, 'handler');

  // Plugin class found?
  if ($class_name) {
    $instance = new $class_name();

    // Has the class implemented the PowerMenuHandlerInterface interface
    if ($instance instanceof PowerMenuHandlerInterface) {
      return $instance;
    }
  }
  return FALSE;
}