You are here

function filter_menu in Drupal 4

Same name and namespace in other branches
  1. 5 modules/filter/filter.module \filter_menu()
  2. 6 modules/filter/filter.module \filter_menu()
  3. 7 modules/filter/filter.module \filter_menu()

Implementation of hook_menu().

File

modules/filter.module, line 61
Framework for handling filtering of content.

Code

function filter_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/filters',
      'title' => t('input formats'),
      'callback' => 'filter_admin_overview',
      'access' => user_access('administer filters'),
    );
    $items[] = array(
      'path' => 'admin/filters/list',
      'title' => t('list'),
      'callback' => 'filter_admin_overview',
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'access' => user_access('administer filters'),
    );
    $items[] = array(
      'path' => 'admin/filters/add',
      'title' => t('add input format'),
      'callback' => 'filter_admin_format_form',
      'type' => MENU_LOCAL_TASK,
      'weight' => 1,
      'access' => user_access('administer filters'),
    );
    $items[] = array(
      'path' => 'admin/filters/delete',
      'title' => t('delete input format'),
      'callback' => 'filter_admin_delete',
      'type' => MENU_CALLBACK,
      'access' => user_access('administer filters'),
    );
    $items[] = array(
      'path' => 'filter/tips',
      'title' => t('compose tips'),
      'callback' => 'filter_tips_long',
      'access' => TRUE,
      'type' => MENU_SUGGESTED_ITEM,
    );
  }
  else {
    if (arg(0) == 'admin' && arg(1) == 'filters' && is_numeric(arg(2))) {
      $formats = filter_formats();
      if (isset($formats[arg(2)])) {
        $items[] = array(
          'path' => 'admin/filters/' . arg(2),
          'title' => t("'%format' input format", array(
            '%format' => $formats[arg(2)]->name,
          )),
          'callback' => 'filter_admin_format_form',
          'callback arguments' => array(
            'format' => $formats[arg(2)],
          ),
          'type' => MENU_CALLBACK,
          'access' => user_access('administer filters'),
        );
        $items[] = array(
          'path' => 'admin/filters/' . arg(2) . '/list',
          'title' => t('view'),
          'callback' => 'filter_admin_format_form',
          'callback arguments' => array(
            'format' => $formats[arg(2)],
          ),
          'type' => MENU_DEFAULT_LOCAL_TASK,
          'weight' => 0,
          'access' => user_access('administer filters'),
        );
        $items[] = array(
          'path' => 'admin/filters/' . arg(2) . '/configure',
          'title' => t('configure'),
          'callback' => 'filter_admin_configure',
          'type' => MENU_LOCAL_TASK,
          'weight' => 1,
          'access' => user_access('administer filters'),
        );
        $items[] = array(
          'path' => 'admin/filters/' . arg(2) . '/order',
          'title' => t('rearrange'),
          'callback' => 'filter_admin_order',
          'callback arguments' => array(
            'format' => $formats[arg(2)],
          ),
          'type' => MENU_LOCAL_TASK,
          'weight' => 2,
          'access' => user_access('administer filters'),
        );
      }
    }
  }
  return $items;
}