You are here

function filter_menu in Drupal 5

Same name and namespace in other branches
  1. 4 modules/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/filter.module, line 52
Framework for handling filtering of content.

Code

function filter_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/filters',
      'title' => t('Input formats'),
      'description' => t('Configure how content input by users is filtered, including allowed HTML tags, PHP code tags. Also allows enabling of module-provided filters.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'filter_admin_overview',
      ),
      'access' => user_access('administer filters'),
    );
    $items[] = array(
      'path' => 'admin/settings/filters/list',
      'title' => t('List'),
      'callback' => 'filter_admin_overview',
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'access' => user_access('administer filters'),
    );
    $items[] = array(
      'path' => 'admin/settings/filters/add',
      'title' => t('Add input format'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'filter_admin_format_form',
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => 1,
      'access' => user_access('administer filters'),
    );
    $items[] = array(
      'path' => 'admin/settings/filters/delete',
      'title' => t('Delete input format'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        '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) == 'settings' && arg(2) == 'filters' && is_numeric(arg(3))) {
      $formats = filter_formats();
      if (isset($formats[arg(3)])) {
        $items[] = array(
          'path' => 'admin/settings/filters/' . arg(3),
          'title' => t("!format input format", array(
            '!format' => $formats[arg(3)]->name,
          )),
          'callback' => 'drupal_get_form',
          'callback arguments' => array(
            'filter_admin_format_form',
            $formats[arg(3)],
          ),
          'type' => MENU_CALLBACK,
          'access' => user_access('administer filters'),
        );
        $items[] = array(
          'path' => 'admin/settings/filters/' . arg(3) . '/list',
          'title' => t('View'),
          'callback' => 'drupal_get_form',
          'callback arguments' => array(
            'filter_admin_format_form',
            $formats[arg(3)],
          ),
          'type' => MENU_DEFAULT_LOCAL_TASK,
          'weight' => 0,
          'access' => user_access('administer filters'),
        );
        $items[] = array(
          'path' => 'admin/settings/filters/' . arg(3) . '/configure',
          'title' => t('Configure'),
          'callback' => 'drupal_get_form',
          'callback arguments' => array(
            'filter_admin_configure',
          ),
          'type' => MENU_LOCAL_TASK,
          'weight' => 1,
          'access' => user_access('administer filters'),
        );
        $items[] = array(
          'path' => 'admin/settings/filters/' . arg(3) . '/order',
          'title' => t('Rearrange'),
          'callback' => 'drupal_get_form',
          'callback arguments' => array(
            'filter_admin_order',
            'format' => $formats[arg(3)],
          ),
          'type' => MENU_LOCAL_TASK,
          'weight' => 2,
          'access' => user_access('administer filters'),
        );
      }
    }
  }
  return $items;
}