+/**
+ * @file
+ * Right-to-Left styling for the Book module.
+ */
.book-navigation .menu {
padding: 1em 3em 0 0;
/**
* @file
- * Admin page callbacks for the book module.
+ * Administration page callbacks for the Book module.
*/
/**
* Returns an administrative overview of all books.
+ *
+ * @return string
+ * A HTML-formatted string with the administrative page content.
+ *
+ * @see book_menu()
*/
function book_admin_overview() {
$rows = array();
/**
* Form validation handler for book_admin_settings().
+ *
+ * @see book_admin_settings_submit()
*/
function book_admin_settings_validate($form, &$form_state) {
$child_type = $form_state['values']['book_child_type'];
* @param $node
* The node of the top-level page in the book.
* @param $form
- * The form that is being modified.
+ * The form that is being modified, passed by reference.
*
* @see book_admin_edit()
*/
* @param $tree
* A subtree of the book menu hierarchy.
* @param $form
- * The form that is being modified.
+ * The form that is being modified, passed by reference.
*
* @return
- * The form that is being modified.
+ * The modified form array.
*
* @see book_admin_edit()
*/
+ /**
+ * @file
+ * Styling for the Book module.
+ */
.book-navigation .menu {
border-top: 1px solid #888;
* Javascript behaviors for the Book module.
*/
-
(function ($) {
Drupal.behaviors.bookFieldsetSummaries = {
*
* A node can be removed from a book if it is actually in a book and it either
* is not a top-level page or is a top-level page with no children.
+ *
+ * @param $node
+ * The node to remove from the outline.
*/
function _book_node_is_removable($node) {
return (!empty($node->book['bid']) && (($node->book['bid'] != $node->nid) || !$node->book['has_children']));
* @param $tree
* A tree of menu links in an array.
* @param $flat
- * A flat array of the menu links from $tree.
+ * A flat array of the menu links from $tree, passed by reference.
*
* @see book_get_flat_menu().
*/
* to the structured data but can also simply iterate over all elements and
* render them (as in the default template).
*
- * The $variables array contains the following elements:
- * - book_menus
+ * @param $variables
+ * An associative array containing the following key:
+ * - book_menus
*
* @see book-all-books-block.tpl.php
*/
/**
* Processes variables for book-navigation.tpl.php.
*
- * The $variables array contains the following elements:
- * - book_link
+ * @param $variables
+ * An associative array containing the following key:
+ * - book_link
*
* @see book-navigation.tpl.php
*/
* Reference to the table of contents array. This is modified in place, so the
* function does not have a return value.
* @param $exclude
- * Optional array of menu link ID values. Any link whose menu link ID is in
- * this array will be excluded (along with its children).
+ * (optional) An array of menu link ID values. Any link whose menu link ID is
+ * in this array will be excluded (along with its children). Defaults to an
+ * empty array.
* @param $depth_limit
* Any link deeper than this value will be excluded (along with its children).
*/
/**
* Processes variables for book-export-html.tpl.php.
*
- * The $variables array contains the following elements:
- * - title
- * - contents
- * - depth
+ * @param $variables
+ * An associative array containing the following keys:
+ * - title
+ * - contents
+ * - depth
*
* @see book-export-html.tpl.php
*/
* @param $node
* The node that will be output.
* @param $children
- * All the rendered child nodes within the current node.
+ * (optional) All the rendered child nodes within the current node. Defaults
+ * to an empty string.
*
* @return
* The HTML generated for the given node.
/**
* Processes variables for book-node-export-html.tpl.php.
*
- * The $variables array contains the following elements:
- * - node
- * - children
+ * @param $variables
+ * An associative array containing the following keys:
+ * - node
+ * - children
*
* @see book-node-export-html.tpl.php
*/
/**
* Determine if a given node type is in the list of types allowed for books.
+ *
+ * @param $type
+ * A node type.
+ *
+ * @return
+ * A Boolean TRUE if the node type can be included in books; otherwise, FALSE.
*/
function book_type_is_allowed($type) {
return in_array($type, variable_get('book_allowed_types', array('book')));
*
* @return
* A menu link, with the link translated for rendering and data added from the
- * {book} table.
+ * {book} table. FALSE if there is an error.
*/
function book_link_load($mlid) {
if ($item = db_query("SELECT * FROM {menu_links} ml INNER JOIN {book} b ON b.mlid = ml.mlid LEFT JOIN {menu_router} m ON m.path = ml.router_path WHERE ml.mlid = :mlid", array(
/**
* Menu callback: Prints a listing of all books.
+ *
+ * @return string
+ * A HTML-formatted string with the listing of all books content.
+ *
+ * @see book_menu()
*/
function book_render() {
$book_list = array();
* @return
* A string representing the node and its children in the book hierarchy in a
* format determined by the $type parameter.
+ *
+ * @see book_menu()
*/
function book_export($type, $nid) {
$type = drupal_strtolower($type);
*
* @param $node
* The book node for which to show the outline.
+ *
+ * @return string
+ * A HTML-formatted string with the outline form for a single node.
+ *
+ * @see book_menu()
*/
function book_outline($node) {
drupal_set_title($node->title);
* Tests for book.module.
*/
+/**
+ * Tests the functionality of the Book module.
+ */
class BookTestCase extends DrupalWebTestCase {
+
+ /**
+ * A book node.
+ *
+ * @var object
+ */
protected $book;
- // $book_author is a user with permission to create and edit books.
+
+ /**
+ * A user with permission to create and edit books.
+ *
+ * @var object
+ */
protected $book_author;
- // $web_user is a user with permission to view a book
- // and access the printer-friendly version.
+
+ /**
+ * A user with permission to view a book and access printer-friendly version.
+ *
+ * @var object
+ */
protected $web_user;
- // $admin_user is a user with permission to create and edit books and to administer blocks.
+
+ /**
+ * A user with permission to create and edit books and to administer blocks.
+ *
+ * @var object
+ */
protected $admin_user;
public static function getInfo() {
}
/**
- * Create a new book with a page hierarchy.
+ * Creates a new book with a page hierarchy.
*/
function createBook() {
// Create new book.
}
/**
- * Test book functionality through node interfaces.
+ * Tests book functionality through node interfaces.
*/
function testBook() {
// Create new book.
}
/**
- * Check the outline of sub-pages; previous, up, and next; and printer friendly version.
+ * Checks the outline of sub-pages; previous, up, and next.
+ *
+ * Also checks the printer friendly version of the outline.
*
* @param $node
* Node to check.
* @param $nodes
* Nodes that should be in outline.
* @param $previous
- * Previous link node.
+ * (optional) Previous link node. Defaults to FALSE.
* @param $up
- * Up link node.
+ * (optional) Up link node. Defaults to FALSE.
* @param $next
- * Next link node.
+ * (optional) Next link node. Defaults to FALSE.
* @param $breadcrumb
* The nodes that should be displayed in the breadcrumb.
*/
}
/**
- * Create a regular expression to check for the sub-nodes in the outline.
+ * Creates a regular expression to check for the sub-nodes in the outline.
+ *
+ * @param array $nodes
+ * An array of nodes to check in outline.
*
- * @param array $nodes Nodes to check in outline.
+ * @return
+ * A regular expression that locates sub-nodes of the outline.
*/
function generateOutlinePattern($nodes) {
$outline = '';
}
/**
- * Create book node.
+ * Creates a book node.
*
- * @param integer $book_nid Book node id or set to 'new' to create new book.
- * @param integer $parent Parent book reference id.
+ * @param $book_nid
+ * A book node ID or set to 'new' to create a new book.
+ * @param $parent
+ * (optional) Parent book reference ID. Defaults to NULL.
*/
function createBookNode($book_nid, $parent = NULL) {
// $number does not use drupal_static as it should not be reset
}
/**
- * Test the book navigation block when an access module is enabled.
+ * Tests the book navigation block when an access module is enabled.
*/
function testNavigationBlockOnAccessModuleEnabled() {
$this->drupalLogin($this->admin_user);