You are here

function swftools_profiles_menu in SWF Tools 6.3

Implementation of hook_menu().

File

profiles/swftools_profiles.module, line 11
Enables the SWF Tools profile system to allow multiple player configurations to be defined.

Code

function swftools_profiles_menu() {

  // Should this be administer swf tools?
  $swf_admin = array(
    'administer flash',
  );
  $items['admin/settings/swftools/profiles'] = array(
    'title' => 'Profiles',
    'file' => 'swftools_profiles.admin.inc',
    'description' => 'Administer SWF Tools profiles.',
    'page callback' => 'swftools_profiles_overview',
    'access arguments' => $swf_admin,
    'weight' => -2,
  );
  $items['admin/settings/swftools/profiles/list'] = array(
    'title' => 'List',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );
  $items['admin/settings/swftools/profiles/add'] = array(
    'title' => 'Add new profile',
    'file' => 'swftools_profiles.admin.inc',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'swftools_profiles_profile_form',
    ),
    'access arguments' => $swf_admin,
    'type' => MENU_LOCAL_TASK,
  );
  $items['admin/settings/swftools/profile/%swftools_profiles_profile'] = array(
    // Use a title call back so that if the title is set we use it
    'title callback' => 'swftools_profiles_title_callback',
    'title arguments' => array(
      4,
    ),
    'file' => 'swftools_profiles.admin.inc',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'swftools_profiles_profile_form',
      4,
    ),
    'access arguments' => $swf_admin,
    'type' => MENU_CALLBACK,
  );
  $items['admin/settings/swftools/profile/%swftools_profiles_profile/edit'] = array(
    'title' => 'Edit',
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['admin/settings/swftools/profile/%swftools_profiles_profile/configure'] = array(
    'title' => 'Configure',
    'file' => 'swftools_profiles.admin.inc',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'swftools_profiles_configure_settings',
      4,
      array(
        'swftools_handlers',
      ),
      'swftools',
      'includes/swftools.admin.inc',
      'swftools_handling_profile_form',
    ),
    'access arguments' => $swf_admin,
    'type' => MENU_LOCAL_TASK,
    'weight' => 1,
  );

  // Convenience link to get back to the profile list
  $items['admin/settings/swftools/profile/%swftools_profiles_profile/list'] = array(
    'title' => 'List',
    'page callback' => 'drupal_goto',
    'page arguments' => array(
      'admin/settings/swftools/profiles',
    ),
    'access arguments' => $swf_admin,
    'type' => MENU_LOCAL_TASK,
    'weight' => -1,
  );
  $items['admin/settings/swftools/profile/%swftools_profiles_profile/configure/handling'] = array(
    'title' => 'File handling',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -1,
  );
  $items['admin/settings/swftools/profile/%swftools_profiles_profile/clone'] = array(
    'title' => 'Add new profile',
    'file' => 'swftools_profiles.admin.inc',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'swftools_profiles_profile_form',
      4,
      TRUE,
    ),
    'access arguments' => $swf_admin,
    'type' => MENU_CALLBACK,
  );
  $items['admin/settings/swftools/profile/%swftools_profiles_profile/delete'] = array(
    'title' => 'Delete',
    'file' => 'swftools_profiles.admin.inc',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'swftools_profiles_delete_confirm',
      4,
    ),
    'access arguments' => $swf_admin,
    'type' => MENU_CALLBACK,
  );

  // Get SWF Tools methods, making sure the cache is flushed
  $methods = swftools_get_methods('', TRUE);

  // Build menu items for settings that support profiles
  foreach ($methods as $handlers) {
    foreach ($handlers as $handler) {
      if ($handler['profile']) {
        $handler['profile'] += array(
          'settings' => array(),
          'module' => '',
          'file' => '',
        );
        $items['admin/settings/swftools/profile/%swftools_profiles_profile/configure/' . $handler['profile']['path']] = array(
          'title' => $handler['title'],
          'file' => 'swftools_profiles.admin.inc',
          'page callback' => 'drupal_get_form',
          'page arguments' => array(
            'swftools_profiles_configure_settings',
            4,
            $handler['profile']['settings'],
            $handler['module'],
            $handler['profile']['file'],
            $handler['profile']['page argument'],
          ),
          'access arguments' => $swf_admin,
          'type' => MENU_LOCAL_TASK,
        );
      }
    }
  }
  return $items;
}