You are here

function views_ui::init in Views (for Drupal 7) 7.3

Fake constructor -- this is easier to deal with than the real constructor because we are retaining PHP4 compatibility, which would require all child classes to implement their own constructor.

Overrides ctools_export_ui::init

File

plugins/export_ui/views_ui.class.php, line 18
Contains the CTools Export UI integration code.

Class

views_ui
CTools Export UI class handler for Views UI.

Code

function init($plugin) {

  // We modify the plugin info here so that we take the defaults and twiddle,
  // rather than completely override them.
  // Reset the edit path to match what we're really using.
  $plugin['menu']['items']['edit']['path'] = 'view/%ctools_export_ui/edit';
  $plugin['menu']['items']['clone']['path'] = 'view/%ctools_export_ui/clone';
  $plugin['menu']['items']['clone']['type'] = MENU_VISIBLE_IN_BREADCRUMB;
  $plugin['menu']['items']['export']['path'] = 'view/%ctools_export_ui/export';
  $plugin['menu']['items']['export']['type'] = MENU_VISIBLE_IN_BREADCRUMB;
  $plugin['menu']['items']['enable']['path'] = 'view/%ctools_export_ui/enable';
  $plugin['menu']['items']['disable']['path'] = 'view/%ctools_export_ui/disable';
  $plugin['menu']['items']['delete']['path'] = 'view/%ctools_export_ui/delete';
  $plugin['menu']['items']['delete']['type'] = MENU_VISIBLE_IN_BREADCRUMB;
  $plugin['menu']['items']['revert']['path'] = 'view/%ctools_export_ui/revert';
  $plugin['menu']['items']['revert']['type'] = MENU_VISIBLE_IN_BREADCRUMB;
  $prefix_count = count(explode('/', $plugin['menu']['menu prefix']));
  $plugin['menu']['items']['add-template'] = array(
    'path' => 'template/%/add',
    'title' => 'Add from template',
    'page callback' => 'ctools_export_ui_switcher_page',
    'page arguments' => array(
      $plugin['name'],
      'add_template',
      $prefix_count + 2,
    ),
    'load arguments' => array(
      $plugin['name'],
    ),
    'access callback' => 'ctools_export_ui_task_access',
    'access arguments' => array(
      $plugin['name'],
      'add_template',
      $prefix_count + 2,
    ),
    'type' => MENU_CALLBACK,
  );
  return parent::init($plugin);
}