You are here

public function ctools_export_ui::hook_menu in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 plugins/export_ui/ctools_export_ui.class.php \ctools_export_ui::hook_menu()

hook_menu() entry point.

Child implementations that need to add or modify menu items should probably call parent::hook_menu($items) and then modify as needed.

File

plugins/export_ui/ctools_export_ui.class.php, line 60

Class

ctools_export_ui
Base class for export UI.

Code

public function hook_menu(&$items) {

  // During upgrades, the schema can be empty as this is called prior to
  // actual update functions being run. Ensure that we can cope with this
  // situation.
  if (empty($this->plugin['schema'])) {
    return;
  }
  $prefix = ctools_export_ui_plugin_base_path($this->plugin);
  if (isset($this->plugin['menu']['items']) && is_array($this->plugin['menu']['items'])) {
    $my_items = array();
    foreach ($this->plugin['menu']['items'] as $item) {

      // Add menu item defaults.
      $item += array(
        'file' => 'export-ui.inc',
        'file path' => drupal_get_path('module', 'ctools') . '/includes',
      );
      $path = !empty($item['path']) ? $prefix . '/' . $item['path'] : $prefix;
      unset($item['path']);
      $my_items[$path] = $item;
    }
    $items += $my_items;
  }
}