You are here

function fillpdf_menu in FillPDF 5

Same name and namespace in other branches
  1. 6 fillpdf.module \fillpdf_menu()
  2. 7.2 fillpdf.module \fillpdf_menu()
  3. 7 fillpdf.module \fillpdf_menu()

Implementation of hook_menu().

File

./fillpdf.module, line 37
Allows mappings of PDFs to site content

Code

function fillpdf_menu($may_cache) {
  if ($may_cache) {
    $access = user_access('administer pdfs');
    $items[] = array(
      'path' => 'fillpdf',
      // fillpdf?fid=10&nid=20
      'callback' => 'fillpdf_generate_pdf',
      'access' => user_access('access content'),
    );
    $items[] = array(
      'path' => 'admin/content/fillpdf',
      'title' => t('Fill PDF'),
      'description' => t('Manage your PDFs.'),
      'callback' => 'fillpdf_admin',
      'access' => $access,
    );
    $items[] = array(
      'path' => 'admin/content/fillpdf/list',
      'title' => t('List PDFs'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    $items[] = array(
      'path' => 'admin/content/fillpdf/add',
      'title' => t('Add PDF'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'fillpdf_form_edit',
        'add',
      ),
      'access' => $access,
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/content/fillpdf/delete',
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'fillpdf_form_delete_confirm',
      ),
      'access' => $access,
      'type' => MENU_CALLBACK,
    );
  }
  else {
    if (is_numeric(arg(4))) {
      $items[] = array(
        'path' => 'admin/content/fillpdf/form/' . arg(4) . '/edit',
        'title' => t('Edit PDF'),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'fillpdf_form_edit',
          'edit',
          arg(4),
        ),
        'access' => $access,
        'type' => MENU_LOCAL_TASK,
        'weight' => -20,
      );
      $items[] = array(
        'path' => 'admin/content/fillpdf/form/' . arg(4),
        'callback' => 'fillpdf_field_edit_field',
        'type' => MENU_CALLBACK,
        'access' => $access,
      );
      $items[] = array(
        'path' => 'admin/content/fillpdf/form/' . arg(4) . '/list',
        'title' => t('List fields'),
        'type' => MENU_DEFAULT_LOCAL_TASK,
        'weight' => -10,
      );
      $items[] = array(
        'path' => 'admin/content/fillpdf/form/' . arg(4) . '/generate',
        'title' => t('Generate Fields From PDF'),
        'callback' => 'fillpdf_generate_fields_from_pdf',
        'callback arguments' => array(
          arg(4),
        ),
        'access' => $access,
        'type' => MENU_CALLBACK,
      );
      $items[] = array(
        'path' => 'admin/content/fillpdf/form/' . arg(4) . '/add',
        'title' => t('Add field'),
        'callback' => 'fillpdf_field_edit_field',
        'access' => $access,
        'type' => MENU_LOCAL_TASK,
      );
      $items[] = array(
        'path' => 'admin/content/fillpdf/form/' . arg(4) . '/edit/' . arg(6),
        'callback' => 'fillpdf_field_edit_field',
        'access' => $access,
        'type' => MENU_CALLBACK,
      );
      $items[] = array(
        'path' => 'admin/content/fillpdf/form/' . arg(4) . '/delete',
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'fillpdf_field_delete_confirm',
          arg(4),
          arg(6),
        ),
        'access' => $access,
        'type' => MENU_CALLBACK,
      );
    }
  }
  return $items;
}