You are here

function panopoly_admin_menu in Panopoly 7

Implementation of hook_menu

File

modules/panopoly/panopoly_admin/panopoly_admin.module, line 323

Code

function panopoly_admin_menu() {

  // Panelizer "revert" page callback
  $items['admin/site/panelizer-delete/%/%'] = array(
    'type' => MENU_CALLBACK,
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'panopoly_admin_panelizer_delete_form',
      3,
      4,
    ),
    'access callback' => 'panopoly_admin_panelizer_revert_access',
    'access arguments' => array(
      3,
      4,
    ),
  );

  // Panels pane layout enable/disable page callback
  $items['admin/panopoly/panes/layout/%/%/%'] = array(
    'type' => MENU_CALLBACK,
    'page callback' => 'panopoly_admin_switch_layout_action',
    'page arguments' => array(
      4,
      5,
      6,
    ),
    'access callback' => 'panopoly_admin_panels_layout_access',
  );

  // Add a local action link for the flexible layout builder
  $items['admin/panopoly/layouts/add-flexible'] = array(
    'title' => 'Add Flexible Layout',
    'description' => 'This will add a flexible layout to Panels',
    'page callback' => 'drupal_goto',
    'page arguments' => array(
      'admin/structure/panels/layouts/add-flexible',
    ),
    'type' => MENU_LOCAL_ACTION,
    'access arguments' => array(
      'administer page manager',
    ),
  );

  // Panels pane enable/disable page callback
  $items['admin/panopoly/panes/pane/%/%/%/%'] = array(
    'type' => MENU_CALLBACK,
    'page callback' => 'panopoly_admin_switch_pane_action',
    'page arguments' => array(
      4,
      5,
      6,
      7,
    ),
    'access arguments' => array(
      'administer page manager',
    ),
  );

  // Add an administration page for Panopoly
  $items['admin/panopoly'] = array(
    'title' => 'Panopoly',
    'description' => 'Administer all things Panopoly.',
    'weight' => -8,
    'position' => 'left',
    'page callback' => 'system_admin_menu_block_page',
    'access arguments' => array(
      'access administration pages',
    ),
    'file' => 'system.admin.inc',
    'file path' => drupal_get_path('module', 'system'),
  );

  // Add an administration section for Panopoly settings
  $items['admin/panopoly/settings'] = array(
    'title' => 'Panopoly Settings',
    'description' => 'Configuration related to Panopoly',
    'weight' => 50,
    'position' => 'left',
    'page callback' => 'system_admin_menu_block_page',
    'access arguments' => array(
      'administer site configuration',
    ),
    'file' => 'system.admin.inc',
    'file path' => drupal_get_path('module', 'system'),
  );

  // Add settings pages for Panopoly and Panopoly Apps
  foreach (module_list() as $module) {
    $app_info = module_invoke($module, 'apps_app_info');
    if (!empty($app_info) && !empty($app_info['configure form'])) {
      $module_info = drupal_parse_info_file(drupal_get_path('module', $module) . '/' . $module . '.info');
      if (!empty($module_info['package']) && $module_info['package'] == 'Panopoly') {
        $items['admin/panopoly/settings/' . $module] = array(
          'title' => $module_info['name'],
          'description' => 'This is the configuration screen for ' . $module_info['name'],
          'page callback' => 'drupal_get_form',
          'page arguments' => array(
            $app_info['configure form'],
          ),
          'access arguments' => array(
            'administer site configuration',
          ),
        );
      }
      elseif (!empty($module_info['package']) && $module_info['package'] == 'Panopoly Apps') {
        $items['admin/panopoly/settings/' . $module] = array(
          'title' => $module_info['name'],
          'description' => 'This is the configuration screen for ' . $module_info['name'],
          'page callback' => 'drupal_get_form',
          'page arguments' => array(
            $app_info['configure form'],
          ),
          'access arguments' => array(
            'administer site configuration',
          ),
        );
        if (!empty($app_info['demo content module']) && !empty($app_info['demo content link path'])) {
          if (module_exists($app_info['demo content module'])) {
            $items[$app_info['demo content link path'] . '/disable_demo_content'] = array(
              'title' => 'Disable Demo Content',
              'description' => 'This will disable the demo content that is provided by this app.',
              'page callback' => 'drupal_get_form',
              'type' => MENU_LOCAL_ACTION,
              'page arguments' => array(
                'panopoly_admin_disable_demo_content_form',
                $app_info['demo content module'],
                $app_info['demo content link path'],
              ),
              'access arguments' => array(
                'administer apps',
              ),
            );
          }
        }
      }
    }
  }
  return $items;
}