Same filename and directory in other branches
  1. 4.7.x modules/page.module

Enables the creation of pages that can be added to the navigation system.

File

modules/page.module
View source
<?php

/**
 * @file
 * Enables the creation of pages that can be added to the navigation system.
 */

/**
 * Implementation of hook_help().
 */
function page_help($section) {
  switch ($section) {
    case 'admin/modules#description':
      return t('Enables the creation of pages that can be added to the navigation system.');
    case 'node/add#page':
      return t('If you want to add a static page, like a contact page or an about page, use a page.');
  }
}

/**
 * Implementation of hook_perm().
 */
function page_perm() {
  return array(
    'create pages',
    'edit own pages',
  );
}

/**
 * Implementation of hook_node_name().
 */
function page_node_name($node) {
  return t('page');
}

/**
 * Implementation of hook_access().
 */
function page_access($op, $node) {
  global $user;
  if ($op == 'create') {
    return user_access('create pages');
  }
  if ($op == 'update' || $op == 'delete') {
    if (user_access('edit own pages') && $user->uid == $node->uid) {
      return TRUE;
    }
  }
}

/**
 * Implementation of hook_menu().
 */
function page_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'node/add/page',
      'title' => t('page'),
      'access' => page_access('create', NULL),
    );
  }
  return $items;
}

/**
 * Implementation of hook_form().
 */
function page_form(&$node) {
  if (function_exists('taxonomy_node_form')) {
    $output .= implode('', taxonomy_node_form('page', $node));
  }
  $output .= form_textarea(t('Body'), 'body', $node->body, 60, 20, '', NULL, TRUE);
  $output .= filter_form('format', $node->format);
  return $output;
}

Functions

Namesort descending Description
page_access Implementation of hook_access().
page_form Implementation of hook_form().
page_help Implementation of hook_help().
page_menu Implementation of hook_menu().
page_node_name Implementation of hook_node_name().
page_perm Implementation of hook_perm().