From bd1713e6731b8af31c6349040a071d085ab7125d Mon Sep 17 00:00:00 2001 From: TravisCarden Date: Thu, 12 Apr 2012 21:52:07 -0500 Subject: [PATCH] Issue #1530700: Fixed coding standards issues in book module. --- core/modules/book/book.admin.inc | 49 +++++++++++++++++++++++++++---------- core/modules/book/book.pages.inc | 25 ++++++++++++------- 2 files changed, 52 insertions(+), 22 deletions(-) diff --git a/core/modules/book/book.admin.inc b/core/modules/book/book.admin.inc index 265b381..985ccb6 100644 --- a/core/modules/book/book.admin.inc +++ b/core/modules/book/book.admin.inc @@ -17,10 +17,20 @@ function book_admin_overview() { // Add any recognized books to the table list. foreach (book_get_books() as $book) { - $rows[] = array(l($book['title'], $book['href'], $book['options']), l(t('edit order and titles'), 'admin/content/book/' . $book['nid'])); + $rows[] = array( + l($book['title'], $book['href'], $book['options']), + l(t('edit order and titles'), 'admin/content/book/' . $book['nid']), + ); } - return theme('table', array('header' => $headers, 'rows' => $rows, 'empty' => t('No books available.'))); + return theme( + 'table', + array( + 'header' => $headers, + 'rows' => $rows, + 'empty' => t('No books available.'), + ) + ); } /** @@ -66,7 +76,7 @@ function book_admin_settings_validate($form, &$form_state) { /** * Form constructor for administering a single book's hierarchy. * - * @param $node + * @param object $node * The node of the top-level page in the book. * * @see book_menu() @@ -147,9 +157,9 @@ function book_admin_edit_submit($form, &$form_state) { /** * Builds the table portion of the form for the book administration page. * - * @param $node + * @param object $node * The node of the top-level page in the book. - * @param $form + * @param array $form * The form that is being modified. * * @see book_admin_edit() @@ -161,7 +171,8 @@ function _book_admin_table($node, &$form) { ); $tree = book_menu_subtree_data($node->book); - $tree = array_shift($tree); // Do not include the book item itself. + // Do not include the book item itself. + $tree = array_shift($tree); if ($tree['below']) { $hash = drupal_hash_base64(serialize($tree['below'])); // Store the hash value as a hidden form element so that we can detect @@ -182,12 +193,12 @@ function _book_admin_table($node, &$form) { /** * Helps build the main table in the book administration page form. * - * @param $tree + * @param array $tree * A subtree of the book menu hierarchy. - * @param $form + * @param array $form * The form that is being modified. * - * @return + * @return array * The form that is being modified. * * @see book_admin_edit() @@ -236,7 +247,7 @@ function _book_admin_table_tree($tree, &$form) { /** * Returns HTML for a book administration form. * - * @param $variables + * @param array $variables * An associative array containing: * - form: A render element representing the form. * @@ -249,7 +260,12 @@ function theme_book_admin_table($variables) { drupal_add_tabledrag('book-outline', 'match', 'parent', 'book-plid', 'book-plid', 'book-mlid', TRUE, MENU_MAX_DEPTH - 2); drupal_add_tabledrag('book-outline', 'order', 'sibling', 'book-weight'); - $header = array(t('Title'), t('Weight'), t('Parent'), array('data' => t('Operations'), 'colspan' => '3')); + $header = array( + t('Title'), + t('Weight'), + t('Parent'), + array('data' => t('Operations'), 'colspan' => '3'), + ); $rows = array(); $destination = drupal_get_destination(); @@ -269,7 +285,7 @@ function theme_book_admin_table($variables) { drupal_render($form[$key]['plid']) . drupal_render($form[$key]['mlid']), l(t('view'), $href), $access ? l(t('edit'), 'node/' . $nid . '/edit', array('query' => $destination)) : ' ', - $access ? l(t('delete'), 'node/' . $nid . '/delete', array('query' => $destination) ) : ' ', + $access ? l(t('delete'), 'node/' . $nid . '/delete', array('query' => $destination)) : ' ', ); $row = array('data' => $data); if (isset($form[$key]['#attributes'])) { @@ -279,5 +295,12 @@ function theme_book_admin_table($variables) { $rows[] = $row; } - return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'book-outline'))); + return theme( + 'table', + array( + 'header' => $header, + 'rows' => $rows, + 'attributes' => array('id' => 'book-outline'), + ) + ); } diff --git a/core/modules/book/book.pages.inc b/core/modules/book/book.pages.inc index 042bcf5..67e1ccd 100644 --- a/core/modules/book/book.pages.inc +++ b/core/modules/book/book.pages.inc @@ -27,15 +27,15 @@ function book_render() { * type. So, e.g., a type of 'html' results in a call to the function * book_export_html(). * - * @param $type + * @param string $type * A string encoding the type of output requested. The following types are * currently supported in book module: * - html: Printer-friendly HTML. * Other types may be supported in contributed modules. - * @param $nid + * @param integer $nid * An integer representing the node id (nid) of the node to export * - * @return + * @return string * A string representing the node and its children in the book hierarchy in a * format determined by the $type parameter. * @@ -65,10 +65,10 @@ function book_export($type, $nid) { * look like level 3 sections, no matter their depth relative to the node * selected to be exported as printer-friendly HTML. * - * @param $nid + * @param integer $nid * An integer representing the node id (nid) of the node to export. * - * @return + * @return string * A string containing HTML representing the node and its children in * the book hierarchy. */ @@ -79,7 +79,14 @@ function book_export_html($nid) { if (isset($node->book)) { $tree = book_menu_subtree_data($node->book); $contents = book_export_traverse($tree, 'book_node_export'); - return theme('book_export_html', array('title' => $node->title, 'contents' => $contents, 'depth' => $node->book['depth'])); + return theme( + 'book_export_html', + array( + 'title' => $node->title, + 'contents' => $contents, + 'depth' => $node->book['depth'], + ) + ); } else { drupal_not_found(); @@ -93,7 +100,7 @@ function book_export_html($nid) { /** * Page callback: Shows the outline form for a single node. * - * @param $node + * @param object $node * The book node for which to show the outline. * * @see book_menu() @@ -108,7 +115,7 @@ function book_outline($node) { * * Allows handling of all book outline operations via the outline tab. * - * @param $node + * @param object $node * The book node for which to show the outline. * * @see book_outline_form_submit() @@ -197,7 +204,7 @@ function book_outline_form_submit($form, &$form_state) { /** * Form constructor to confirm removal of a node from a book. * - * @param $node + * @param object $node * The node to delete. * * @see book_remove_form_submit() -- 1.7.4.1