You are here

function publishcontent_menu in Publish Content 7

Same name and namespace in other branches
  1. 5.2 publishcontent.module \publishcontent_menu()
  2. 5 publishcontent.module \publishcontent_menu()
  3. 6 publishcontent.module \publishcontent_menu()

Implements hook_menu().

File

./publishcontent.module, line 21
Add link to publish or unpublish a node, with access control based on the node type

Code

function publishcontent_menu() {
  $items = array();
  $menu_type = _publishcontent_get_menutype();
  $items['admin/config/content/publishcontent'] = array(
    'title' => 'Publish content settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'publishcontent_config_form',
    ),
    'access callback' => 'user_access',
    'access arguments' => array(
      'administer site configuration',
    ),
    'description' => 'Configure settings.',
    'file' => 'publishcontent.admin.inc',
    'type' => MENU_NORMAL_ITEM,
  );
  $items['node/%publishcontent_tab/publish/%publishcontent_security_token'] = array(
    'title' => 'Publish',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'publishcontent_toggle_status_form',
      1,
      2,
    ),
    'access callback' => '_publishcontent_publish_access',
    'access arguments' => array(
      1,
      3,
    ),
    'weight' => 5,
    'type' => $menu_type,
    'options' => array(
      'attributes' => array(
        'class' => array(
          'publishcontent-link',
          'publishcontent-publish',
        ),
      ),
    ),
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
  );
  $items['node/%publishcontent_tab/unpublish/%publishcontent_security_token'] = array(
    'title' => 'Unpublish',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'publishcontent_toggle_status_form',
      1,
      2,
    ),
    'access callback' => '_publishcontent_unpublish_access',
    'access arguments' => array(
      1,
      3,
    ),
    'weight' => 5,
    'type' => $menu_type,
    'options' => array(
      'attributes' => array(
        'class' => array(
          'publishcontent-link',
          'publishcontent-unpublish',
        ),
      ),
    ),
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
  );
  return $items;
}