diff --git a/core/modules/node/content_types.inc b/core/modules/node/content_types.inc index 355a022..055050e 100644 --- a/core/modules/node/content_types.inc +++ b/core/modules/node/content_types.inc @@ -8,6 +8,9 @@ /** * Page callback: Displays the content type admin overview page. * + * @return + * An array as expected by drupal_render(). + * * @see node_menu() */ function node_overview_types() { @@ -63,6 +66,9 @@ function node_overview_types() { * - type: An object containing the 'type' (machine name) and 'description' of * the content type. * + * @return + * An HTML-formatted string of the description for this node type. + * * @ingroup themeable */ function theme_node_admin_overview($variables) { @@ -278,6 +284,12 @@ function node_type_form($form, &$form_state, $type = NULL) { /** * Helper function for teaser length choices. + * + * @param $length + * An integer representing the desired length of the teaser string. + * + * @return + * A string that reprents the teaser length options. */ function _node_characters($length) { return ($length == 0) ? t('Unlimited') : format_plural($length, '1 character', '@count characters'); diff --git a/core/modules/node/node.admin.inc b/core/modules/node/node.admin.inc index b28a190..b06cb1b 100644 --- a/core/modules/node/node.admin.inc +++ b/core/modules/node/node.admin.inc @@ -10,8 +10,11 @@ use Drupal\Core\Database\Query\SelectInterface; /** * Page callback: Form constructor for the permission rebuild confirmation form. * - * @see node_menu() + * @return + * An array as expected by drupal_render(). + * * @see node_configure_rebuild_confirm_submit() + * @see node_menu() */ function node_configure_rebuild_confirm() { return confirm_form(array(), t('Are you sure you want to rebuild the permissions on site content?'), @@ -73,7 +76,7 @@ function node_node_operations() { * Lists node administration filters that can be applied. * * @return - * Associative array of filters. + * An associative array of filters. */ function node_filters() { // Regular filters @@ -124,7 +127,7 @@ function node_filters() { /** * Applies filters for the node administration overview based on session. * - * @param $query + * @param Drupal\Core\Database\Query\SelectInterface $query * A SelectQuery to which the filters should be applied. */ function node_build_filter_query(SelectInterface $query) { @@ -145,14 +148,15 @@ function node_build_filter_query(SelectInterface $query) { } /** - * Returns the node administration filters form object to node_admin_content(). + * Returns the node administration filters form array to node_admin_content(). * - * @see node_multiple_delete_confirm() - * @see node_multiple_delete_confirm_submit() * @see node_admin_nodes() * @see node_admin_nodes_submit() * @see node_admin_nodes_validate() * @see node_filter_form_submit() + * @see node_multiple_delete_confirm() + * @see node_multiple_delete_confirm_submit() + * * @ingroup forms */ function node_filter_form() { @@ -231,12 +235,12 @@ function node_filter_form() { * Form submission handler for node_filter_form(). * * @see node_admin_content() - * @see node_multiple_delete_confirm() - * @see node_multiple_delete_confirm_submit() * @see node_admin_nodes() * @see node_admin_nodes_submit() * @see node_admin_nodes_validate() * @see node_filter_form() + * @see node_multiple_delete_confirm() + * @see node_multiple_delete_confirm_submit() */ function node_filter_form_submit($form, &$form_state) { $filters = node_filters(); @@ -310,6 +314,9 @@ function node_mass_update($nodes, $updates) { * @param $updates * Associative array of updates. * + * @return + * An updated node object. + * * @see node_mass_update() */ function _node_mass_update_helper($nid, $updates) { @@ -325,6 +332,13 @@ function _node_mass_update_helper($nid, $updates) { /** * Executes a batch operation for node_mass_update(). + * + * @param $nodes + * An array of node IDs. + * @param $updates + * Associative array of updates. + * @param $context + * An array of contextual key/values. */ function _node_mass_update_batch_process($nodes, $updates, &$context) { if (!isset($context['sandbox']['progress'])) { @@ -356,6 +370,14 @@ function _node_mass_update_batch_process($nodes, $updates, &$context) { /** * Reports the 'finished' status of batch operation for node_mass_update(). + * + * @param $success + * A boolean indicating whether the batch mass update operation successfully + * concluded. + * @param $results + * The number of nodes updated via the batch mode process. + * @param $operations + * An array of function calls (not used in this function). */ function _node_mass_update_batch_finished($success, $results, $operations) { if ($success) { @@ -372,14 +394,14 @@ function _node_mass_update_batch_finished($success, $results, $operations) { /** * Page callback: Form constructor for the content administration form. * - * @see node_multiple_delete_confirm() - * @see node_multiple_delete_confirm_submit() * @see node_admin_nodes() * @see node_admin_nodes_submit() * @see node_admin_nodes_validate() * @see node_filter_form() * @see node_filter_form_submit() * @see node_menu() + * @see node_multiple_delete_confirm() + * @see node_multiple_delete_confirm_submit() */ function node_admin_content($form, $form_state) { if (isset($form_state['values']['operation']) && $form_state['values']['operation'] == 'delete') { @@ -395,12 +417,13 @@ function node_admin_content($form, $form_state) { /** * Returns the admin form object to node_admin_content(). * - * @see node_multiple_delete_confirm() - * @see node_multiple_delete_confirm_submit() * @see node_admin_nodes_submit() * @see node_admin_nodes_validate() * @see node_filter_form() * @see node_filter_form_submit() + * @see node_multiple_delete_confirm() + * @see node_multiple_delete_confirm_submit() + * * @ingroup forms */ function node_admin_nodes() { @@ -589,12 +612,12 @@ function node_admin_nodes() { * Checks if any nodes have been selected to perform the chosen * 'Update option' on. * - * @see node_multiple_delete_confirm() - * @see node_multiple_delete_confirm_submit() * @see node_admin_nodes() * @see node_admin_nodes_submit() * @see node_filter_form() * @see node_filter_form_submit() + * @see node_multiple_delete_confirm() + * @see node_multiple_delete_confirm_submit() */ function node_admin_nodes_validate($form, &$form_state) { // Error if there are no items to select. @@ -608,12 +631,12 @@ function node_admin_nodes_validate($form, &$form_state) { * * Executes the chosen 'Update option' on the selected nodes. * - * @see node_multiple_delete_confirm() - * @see node_multiple_delete_confirm_submit() * @see node_admin_nodes() * @see node_admin_nodes_validate() * @see node_filter_form() * @see node_filter_form_submit() + * @see node_multiple_delete_confirm() + * @see node_multiple_delete_confirm_submit() */ function node_admin_nodes_submit($form, &$form_state) { $operations = module_invoke_all('node_operations'); @@ -642,12 +665,12 @@ function node_admin_nodes_submit($form, &$form_state) { /** * Multiple node deletion confirmation form for node_admin_content(). * - * @see node_multiple_delete_confirm_submit() * @see node_admin_nodes() * @see node_admin_nodes_submit() * @see node_admin_nodes_validate() * @see node_filter_form() * @see node_filter_form_submit() + * @see node_multiple_delete_confirm_submit() */ function node_multiple_delete_confirm($form, &$form_state, $nodes) { $form['nodes'] = array('#prefix' => '', '#tree' => TRUE); @@ -675,12 +698,12 @@ function node_multiple_delete_confirm($form, &$form_state, $nodes) { /** * Form submission handler for node_multiple_delete_confirm(). * - * @see node_multiple_delete_confirm() * @see node_admin_nodes() * @see node_admin_nodes_submit() * @see node_admin_nodes_validate() * @see node_filter_form() * @see node_filter_form_submit() + * @see node_multiple_delete_confirm() */ function node_multiple_delete_confirm_submit($form, &$form_state) { if ($form_state['values']['confirm']) { diff --git a/core/modules/node/node.install b/core/modules/node/node.install index 5727129..b48f92e 100644 --- a/core/modules/node/node.install +++ b/core/modules/node/node.install @@ -454,6 +454,9 @@ function node_install() { /** * Implements hook_uninstall(). + * + * @see node_ranking() + * @see _node_rankings() */ function node_uninstall() { // Delete node type variables. @@ -473,7 +476,6 @@ function node_uninstall() { } // Delete node search ranking variables. - // @see node_ranking(), _node_rankings() variable_del('node_rank_relevance'); variable_del('node_rank_sticky'); variable_del('node_rank_promote'); diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 8a41887..21ce0b2 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -286,6 +286,9 @@ function node_field_display_node_alter(&$display, $context) { * * @param Drupal\node\Node $node * A node entity. + * + * @return array + * An array with 'path' as the key and Node ID as its value. */ function node_uri(Node $node) { return array( @@ -359,6 +362,13 @@ function node_tag_new(Node $node) { /** * Retrieves the timestamp for the current user's last view of a specified node. + * + * @param $nid + * A node ID. + * + * @return + * If a node has been previously viewed by the user, the timestamp in seconds + * of when the last view occurred; otherwise, zero. */ function node_last_viewed($nid) { global $user; @@ -410,6 +420,7 @@ function node_mark($nid, $timestamp) { * @return * An array of node types, as objects, keyed by the type. * + * @see _node_types_build() * @see node_type_load() */ function node_type_get_types() { @@ -444,6 +455,8 @@ function node_type_get_base($type) { * * @return * An array of node type labels, keyed by the node type name. + * + * @see _node_types_build() */ function node_type_get_names() { return _node_types_build()->names; @@ -783,7 +796,8 @@ function node_type_update_nodes($old_type, $type) { * until node_types_rebuild() is called. * * @param $rebuild - * TRUE to rebuild node types. Equivalent to calling node_types_rebuild(). + * (optional) TRUE to rebuild node types. Equivalent to calling + * node_types_rebuild(). Defaults to FALSE. * * @return * An object with two properties: @@ -896,6 +910,8 @@ function node_type_cache_reset() { * * @return * A node type object, with missing values in $info set to their defaults. + * + * @see hook_node_ifo() */ function node_type_set_defaults($info = array()) { $info = (array) $info; @@ -998,7 +1014,8 @@ function node_hook($type, $hook) { * @param $hook * A string containing the name of the hook. * @param $a2, $a3, $a4 - * Arguments to pass on to the hook, after the $node argument. + * (optional) Arguments to pass on to the hook, after the $node argument. All + * default to NULL. * * @return * The returned value of the invoked hook. @@ -1019,7 +1036,8 @@ function node_invoke($node, $hook, $a2 = NULL, $a3 = NULL, $a4 = NULL) { * @param array $nids * (optional) An array of entity IDs. If omitted, all entities are loaded. * @param bool $reset - * (optional) Whether to reset the internal node_load() cache. + * (optional) Whether to reset the internal node_load() cache. Defaults to + * FALSE. * * @return array * An array of node entities indexed by nid. @@ -1037,7 +1055,8 @@ function node_load_multiple(array $nids = NULL, $reset = FALSE) { * @param int $nid * The node ID. * @param bool $reset - * (optional) Whether to reset the node_load_multiple() cache. + * (optional) Whether to reset the node_load_multiple() cache. Defaults to + * FALSE. * * @return Drupal\node\Node|false * A fully-populated node entity, or FALSE if the node is not found. @@ -1061,6 +1080,12 @@ function node_revision_load($vid = NULL) { /** * Prepares a node for saving by populating the author and creation date. + * + * @param $node + * A node object. + * + * @return + * An updated node object. */ function node_submit($node) { global $user; @@ -1128,7 +1153,7 @@ function node_delete_multiple($nids) { * The revision ID to delete. * * @return - * TRUE if the revision deletion was successful. + * TRUE if the revision deletion was successful; otherwise, FALSE. */ function node_revision_delete($revision_id) { if ($revision = node_revision_load($revision_id)) { @@ -1294,7 +1319,7 @@ function node_build_content(Node $node, $view_mode = 'full', $langcode = NULL) { * A node entity. * @param $message * (optional) A flag which sets a page title relevant to the revision being - * viewed. + * viewed. Default is FALSE. * * @return * A $page element suitable for use by drupal_render(). @@ -1763,10 +1788,11 @@ function theme_node_search_admin($variables) { * @param object $account * (optional) A user object representing the user for whom the operation is * to be performed. Determines access for a user other than the current user. + * Defaults to NULL. * @param $langcode * (optional) Language code for the variant of the node. Different language * variants might have different permissions associated. If NULL, the - * original langcode of the node is used. + * original langcode of the node is used. Defaults to NULL. * * @return * TRUE if the operation may be performed, FALSE otherwise. @@ -2049,6 +2075,9 @@ function node_menu_local_tasks_alter(&$data, $router_item, $root_path) { * @param $type * The node type object. * + * @return + * An unsanitized string that is the title of the node type edit form. + * * @see node_menu() */ function node_type_page_title($type) { @@ -2061,6 +2090,9 @@ function node_type_page_title($type) { * @param Drupal\node\Node $node * The node entity. * + * @return + * An unsanitized string that is the title of the node. + * * @see node_menu() */ function node_page_title(Node $node) { @@ -2085,6 +2117,9 @@ function node_last_changed($nid) { * * @param Drupal\node\Node $node * The node entity. + * + * @return + * An associative array keyed by node revision number. */ function node_revision_list(Node $node) { $revisions = array(); @@ -2439,6 +2474,9 @@ function node_block_list_alter(&$blocks) { * @link http://cyber.law.harvard.edu/rss/rss.html RSS 2.0 Specification. @endlink * The link should be an absolute URL. * + * @return Symfony\Component\HttpFoundation\Response + * A response object. + * * @see node_menu() */ function node_feed($nids = FALSE, $channel = array()) { @@ -2544,6 +2582,9 @@ function node_view_multiple($nodes, $view_mode = 'teaser', $weight = 0, $langcod /** * Page callback: Generates a listing of promoted nodes. * + * @return + * An array in the format expected by drupal_render(). + * * @see node_menu() */ function node_page_default() { @@ -2600,6 +2641,9 @@ function node_page_default() { * @param Drupal\node\Node $node * The node entity. * + * @return + * A page array suitable for use by drupal_render(). + * * @see node_menu() */ function node_page_view(Node $node) { @@ -2907,10 +2951,11 @@ function node_form_system_themes_admin_form_submit($form, &$form_state) { * @param $account * (optional) A user object representing the user for whom the operation is to * be performed. Determines access for a user other than the current user. + * Defaults to NULL. * @param $langcode * (optional) Language code for the variant of the node. Different language * variants might have different permissions associated. If NULL, the - * original langcode of the node is used. + * original langcode of the node is used. Defaults to NULL. * * @return * TRUE if the operation may be performed, FALSE otherwise. @@ -3122,7 +3167,7 @@ function node_permissions_get_configured_types() { * The operation that the user is trying to perform. * @param $account * (optional) The user object for the user performing the operation. If - * omitted, the current user is used. + * omitted, the current user is used. Defaults to NULL. * * @return * An associative array in which the keys are realms, and the values are @@ -3156,7 +3201,7 @@ function node_access_grants($op, $account = NULL) { * * @param $account * (optional) The user object for the user whose access is being checked. If - * omitted, the current user is used. + * omitted, the current user is used.Defaults to NULL. * * @return * TRUE if 'view' access to all nodes is granted, FALSE otherwise. @@ -3241,6 +3286,14 @@ function node_query_entity_field_access_alter(AlterableInterface $query) { * Either 'node' or 'entity' depending on what sort of query it is. See * node_query_node_access_alter() and node_query_entity_field_access_alter() * for more. + * + * @return + * Returns NULL if the user can bypass node access, or if there are no node + * access modules, or if the $account has a global view grant in a view + * operation; otherwise, does not return a value. + * + * @see node_query_node_access_alter() + * @see node_query_entity_field_access_alter() */ function _node_query_node_access_alter($query, $type) { global $user; @@ -3419,11 +3472,12 @@ function node_access_acquire_grants(Node $node, $delete = TRUE) { * is a module-defined id to define grant privileges. each grant_* field * is a boolean value. * @param $realm - * (optional) If provided, read/write grants for that realm only. + * (optional) If provided, read/write grants for that realm only. Defaults to + * NULL. * @param $delete * (optional) If false, does not delete records. This is only for optimization * purposes, and assumes the caller has already performed a mass delete of - * some form. + * some form. Defaults to TRUE. */ function _node_access_write_grants(Node $node, $grants, $realm = NULL, $delete = TRUE) { if ($delete) { @@ -3498,7 +3552,8 @@ function node_access_needs_rebuild($rebuild = NULL) { * has a large number of nodes). hook_update_N() and any form submit handler * are safe contexts to use the 'batch mode'. Less decidable cases (such as * calls from hook_user(), hook_taxonomy(), etc.) might consider using the - * non-batch mode. + * non-batch mode. Defaults to FALSE. + * * @see node_access_needs_rebuild() */ function node_access_rebuild($batch_mode = FALSE) { @@ -3558,6 +3613,9 @@ function node_access_rebuild($batch_mode = FALSE) { * This is a multistep operation : we go through all nodes by packs of 20. * The batch processing engine interrupts processing and sends progress * feedback after 1 second execution time. + * + * @param $context + * An array of contextual key/value information for rebuild batch process. */ function _node_access_rebuild_batch_operation(&$context) { if (empty($context['sandbox'])) { @@ -3589,6 +3647,13 @@ function _node_access_rebuild_batch_operation(&$context) { /** * Post-processing for node_access_rebuild_batch. + * + * @param $success + * A boolean indicating whether the re-build process has completed. + * @param $results + * An array of results information. + * @param $operations + * An array of function calls (not used in this function). */ function _node_access_rebuild_batch_finished($success, $results, $operations) { if ($success) { @@ -3912,6 +3977,12 @@ function node_assign_owner_action_submit($form, $form_state) { /** * Generates settings form for node_unpublish_by_keyword_action(). + * + * @param $context + * Array of additional information about what triggered this action. + * + * @return + * A form array. */ function node_unpublish_by_keyword_action_form($context) { $form['keywords'] = array( diff --git a/core/modules/node/node.pages.inc b/core/modules/node/node.pages.inc index 12437e1..c671875 100644 --- a/core/modules/node/node.pages.inc +++ b/core/modules/node/node.pages.inc @@ -14,6 +14,12 @@ use Drupal\node\Node; /** * Page callback: Presents the node editing form. * + * @param $node + * A node object. + * + * @return + * A form array as expected by drupal_render(). + * * @see node_menu() */ function node_page_edit($node) { @@ -26,6 +32,11 @@ function node_page_edit($node) { * * Redirects to node/add/[type] if only one content type is available. * + * @return + * A render array for a list of the node types that can be added; however, if + * there is only one node type defined for the site, the function redirects + * to the node add page for that one node type and does not return at all. + * * @see node_menu() */ function node_add_page() { @@ -51,7 +62,11 @@ function node_add_page() { * An associative array containing: * - content: An array of content types. * + * @return + * An HTML-formatted string. + * * @see node_add_page() + * * @ingroup themeable */ function theme_node_add_list($variables) { @@ -80,7 +95,7 @@ function theme_node_add_list($variables) { * The node type object for the submitted node. * * @return - * Returns a node submission form. + * A node submission form. * * @see node_menu() */ @@ -107,7 +122,7 @@ function node_add($node_type) { * The node to preview. * * @return - * Themed node preview. + * An HTML-formatted string of a node preview. * * @see node_form_build_preview() */ @@ -155,6 +170,7 @@ function node_preview(Node $node) { * - node: The node entity which is being previewed. * * @see NodeFormController::preview() + * * @ingroup themeable */ function theme_node_preview($variables) { @@ -187,6 +203,12 @@ function theme_node_preview($variables) { /** * Page callback: Form constructor for node deletion confirmation form. * + * @param $node + * A node object. + * + * @return + * A form array. + * * @see node_menu() */ function node_delete_confirm($form, &$form_state, $node) { @@ -218,6 +240,12 @@ function node_delete_confirm_submit($form, &$form_state) { /** * Page callback: Generates an overview table of older revisions of a node. * + * @param $node + * A node object. + * + * @return + * An array as expected by drupal_render(). + * * @see node_menu() */ function node_revision_overview($node) { @@ -276,6 +304,12 @@ function node_revision_overview($node) { * * This form prevents against CSRF attacks. * + * @param $node_revision + * The node revision ID. + * + * @return + * An array as expected by drupal_render(). + * * @see node_menu() * @see node_revision_revert_confirm_submit() */ @@ -311,6 +345,12 @@ function node_revision_revert_confirm_submit($form, &$form_state) { * * This form prevents against CSRF attacks. * + * @param $node_revision + * The node revision ID. + * + * @return + * An array as expected by drupal_render(). + * * @see node_menu() * @see node_revision_delete_confirm_submit() */ diff --git a/core/modules/poll/lib/Drupal/poll/Tests/PollBlockTest.php b/core/modules/poll/lib/Drupal/poll/Tests/PollBlockTest.php index 3febde0..3a58551 100644 --- a/core/modules/poll/lib/Drupal/poll/Tests/PollBlockTest.php +++ b/core/modules/poll/lib/Drupal/poll/Tests/PollBlockTest.php @@ -7,9 +7,6 @@ namespace Drupal\poll\Tests; -/** - * Tests the recent poll block. - */ class PollBlockTest extends PollTestBase { /** @@ -35,9 +32,6 @@ class PollBlockTest extends PollTestBase { $this->drupalLogin($admin_user); } - /** - * Tests creating, viewing, voting on recent poll block. - */ function testRecentBlock() { // Set block title to confirm that the interface is available. $this->drupalPost('admin/structure/block/manage/poll/recent/configure', array('title' => $this->randomName(8)), t('Save block')); diff --git a/core/modules/poll/lib/Drupal/poll/Tests/PollCreateTest.php b/core/modules/poll/lib/Drupal/poll/Tests/PollCreateTest.php index 0618ce1..d1d7ad4 100644 --- a/core/modules/poll/lib/Drupal/poll/Tests/PollCreateTest.php +++ b/core/modules/poll/lib/Drupal/poll/Tests/PollCreateTest.php @@ -7,9 +7,6 @@ namespace Drupal\poll\Tests; -/** - * Tests creating a poll. - */ class PollCreateTest extends PollTestBase { public static function getInfo() { return array( @@ -19,9 +16,6 @@ class PollCreateTest extends PollTestBase { ); } - /** - * Tests creating, listing, editing a new poll. - */ function testPollCreate() { $title = $this->randomName(); $choices = $this->_generateChoices(7); @@ -63,9 +57,6 @@ class PollCreateTest extends PollTestBase { $this->assertTrue(strpos(end($votes), $vote_count) > 0, "Votes saved."); } - /** - * Tests creating, editing, and closing a poll. - */ function testPollClose() { $content_user = $this->drupalCreateUser(array('create poll content', 'edit any poll content', 'access content')); $vote_user = $this->drupalCreateUser(array('cancel own vote', 'inspect all votes', 'vote on polls', 'access content')); diff --git a/core/modules/poll/lib/Drupal/poll/Tests/PollDeleteChoiceTest.php b/core/modules/poll/lib/Drupal/poll/Tests/PollDeleteChoiceTest.php index ccbd044..dfe802c 100644 --- a/core/modules/poll/lib/Drupal/poll/Tests/PollDeleteChoiceTest.php +++ b/core/modules/poll/lib/Drupal/poll/Tests/PollDeleteChoiceTest.php @@ -7,9 +7,6 @@ namespace Drupal\poll\Tests; -/** - * Tests the removal of poll choices. - */ class PollDeleteChoiceTest extends PollTestBase { public static function getInfo() { return array( @@ -19,9 +16,6 @@ class PollDeleteChoiceTest extends PollTestBase { ); } - /** - * Tests removing a choice from a poll. - */ function testChoiceRemoval() { // Set up a poll with three choices. $title = $this->randomName(); diff --git a/core/modules/poll/lib/Drupal/poll/Tests/PollExpirationTest.php b/core/modules/poll/lib/Drupal/poll/Tests/PollExpirationTest.php index 2cfe9e5..b601d77 100644 --- a/core/modules/poll/lib/Drupal/poll/Tests/PollExpirationTest.php +++ b/core/modules/poll/lib/Drupal/poll/Tests/PollExpirationTest.php @@ -7,9 +7,6 @@ namespace Drupal\poll\Tests; -/** - * Tests the expiration of polls. - */ class PollExpirationTest extends PollTestBase { public static function getInfo() { return array( @@ -19,9 +16,6 @@ class PollExpirationTest extends PollTestBase { ); } - /** - * Tests the expiration of a poll. - */ function testAutoExpire() { // Set up a poll. $title = $this->randomName(); diff --git a/core/modules/poll/lib/Drupal/poll/Tests/PollJsAddChoiceTest.php b/core/modules/poll/lib/Drupal/poll/Tests/PollJsAddChoiceTest.php index 88acc3b..f793a83 100644 --- a/core/modules/poll/lib/Drupal/poll/Tests/PollJsAddChoiceTest.php +++ b/core/modules/poll/lib/Drupal/poll/Tests/PollJsAddChoiceTest.php @@ -10,7 +10,7 @@ namespace Drupal\poll\Tests; use Drupal\simpletest\WebTestBase; /** - * Tests adding new choices to a poll. + * Test adding new choices. */ class PollJsAddChoiceTest extends WebTestBase { @@ -30,7 +30,7 @@ class PollJsAddChoiceTest extends WebTestBase { } /** - * Tests adding a new choice to a poll. + * Test adding a new choice. */ function testAddChoice() { $web_user = $this->drupalCreateUser(array('create poll content', 'access content')); diff --git a/core/modules/poll/lib/Drupal/poll/Tests/PollTestBase.php b/core/modules/poll/lib/Drupal/poll/Tests/PollTestBase.php index 94da1ef..7bc2238 100644 --- a/core/modules/poll/lib/Drupal/poll/Tests/PollTestBase.php +++ b/core/modules/poll/lib/Drupal/poll/Tests/PollTestBase.php @@ -9,9 +9,6 @@ namespace Drupal\poll\Tests; use Drupal\simpletest\WebTestBase; -/** - * Defines a base class for testing the Poll module. - */ abstract class PollTestBase extends WebTestBase { /** @@ -119,9 +116,6 @@ abstract class PollTestBase extends WebTestBase { return array($edit, count($already_submitted_choices) + count($new_choices)); } - /* - * Generates random choices for the poll. - */ function _generateChoices($count = 7) { $choices = array(); for ($i = 1; $i <= $count; $i++) { @@ -131,7 +125,7 @@ abstract class PollTestBase extends WebTestBase { } /** - * Asserts correct poll choice order in the node form after submission. + * Assert correct poll choice order in the node form after submission. * * Verifies both the order in the DOM and in the 'weight' form elements. * @@ -191,9 +185,6 @@ abstract class PollTestBase extends WebTestBase { } } - /** - * Tests updating a poll. - */ function pollUpdate($nid, $title, $edit) { // Edit the poll node. $this->drupalPost('node/' . $nid . '/edit', $edit, t('Save')); diff --git a/core/modules/poll/lib/Drupal/poll/Tests/PollTokenReplaceTest.php b/core/modules/poll/lib/Drupal/poll/Tests/PollTokenReplaceTest.php index 13f2f79..63fb6a7 100644 --- a/core/modules/poll/lib/Drupal/poll/Tests/PollTokenReplaceTest.php +++ b/core/modules/poll/lib/Drupal/poll/Tests/PollTokenReplaceTest.php @@ -8,7 +8,7 @@ namespace Drupal\poll\Tests; /** - * Tests poll token replacements in strings. + * Test poll token replacement in strings. */ class PollTokenReplaceTest extends PollTestBase { public static function getInfo() { diff --git a/core/modules/poll/lib/Drupal/poll/Tests/PollVoteCheckHostnameTest.php b/core/modules/poll/lib/Drupal/poll/Tests/PollVoteCheckHostnameTest.php index 8efc02c..6e46faa 100644 --- a/core/modules/poll/lib/Drupal/poll/Tests/PollVoteCheckHostnameTest.php +++ b/core/modules/poll/lib/Drupal/poll/Tests/PollVoteCheckHostnameTest.php @@ -49,10 +49,8 @@ class PollVoteCheckHostnameTest extends PollTestBase { } /** - * Checks that anonymous users with the same IP address can only vote once. - * - * Also checks that authenticated users can only vote once, even when the - * user's IP address has changed. + * Check that anonymous users with same ip cannot vote on poll more than once + * unless user is logged in. */ function testHostnamePollVote() { // Login User1. diff --git a/core/modules/poll/lib/Drupal/poll/Tests/PollVoteTest.php b/core/modules/poll/lib/Drupal/poll/Tests/PollVoteTest.php index b8a2585..63e79b3 100644 --- a/core/modules/poll/lib/Drupal/poll/Tests/PollVoteTest.php +++ b/core/modules/poll/lib/Drupal/poll/Tests/PollVoteTest.php @@ -7,9 +7,6 @@ namespace Drupal\poll\Tests; -/** - * Tests voting on a poll. - */ class PollVoteTest extends PollTestBase { public static function getInfo() { return array( @@ -23,9 +20,6 @@ class PollVoteTest extends PollTestBase { parent::tearDown(); } - /** - * Tests voting on a poll. - */ function testPollVote() { $title = $this->randomName(); $choices = $this->_generateChoices(7); diff --git a/core/modules/poll/poll.install b/core/modules/poll/poll.install index 75896bb..c848445 100644 --- a/core/modules/poll/poll.install +++ b/core/modules/poll/poll.install @@ -2,7 +2,7 @@ /** * @file - * Install, update, and uninstall functions for the Poll module. + * Install, update and uninstall functions for the poll module. */ /** diff --git a/core/modules/poll/poll.module b/core/modules/poll/poll.module index c85f121..dc4722e 100644 --- a/core/modules/poll/poll.module +++ b/core/modules/poll/poll.module @@ -2,7 +2,8 @@ /** * @file - * Collects votes on different topics in the form of multiple choice questions. + * Enables your site to capture votes on different topics in the form of multiple + * choice questions. */ use Drupal\node\Node; @@ -105,14 +106,7 @@ function poll_menu() { } /** - * Access callback: Determines if a node is acceptable for poll menu items. - * - * @param $node - * The poll node object. - * @param $perm - * A permission the user must have to view the page. - * @param $inspect_allowvotes - * TRUE if the user can view votes, and FALSE if the user cannot view votes. + * Callback function to see if a node is acceptable for poll menu items. */ function _poll_menu_access($node, $perm, $inspect_allowvotes) { return user_access($perm) && ($node->type == 'poll') && ($node->allowvotes || !$inspect_allowvotes); @@ -131,8 +125,6 @@ function poll_block_info() { * Implements hook_block_view(). * * Generates a block containing the latest poll. - * - * @see poll_block_latest_poll_view() */ function poll_block_view($delta = '') { if (user_access('access content')) { @@ -350,13 +342,13 @@ function poll_form(Node $node, &$form_state) { } /** - * Form submission handler for adding more than two choices to a poll. + * Submit handler to add more choices to a poll form. * - * This handler is run regardless of whether JavaScript is enabled. It makes - * changes to the form state. If the button is clicked with JavaScript - * disabled, then the page is reloaded with the complete rebuilt form. If the - * button was clicked with JavaScript enabled, then ajax_form_callback() calls - * poll_choice_js() to return just the changed part of the form. + * This handler is run regardless of whether JS is enabled or not. It makes + * changes to the form state. If the button was clicked with JS disabled, then + * the page is reloaded with the complete rebuilt form. If the button was + * clicked with JS enabled, then ajax_form_callback() calls poll_choice_js() to + * return just the changed part of the form. */ function poll_more_choices_submit($form, &$form_state) { // Add one more choice to the form. @@ -373,11 +365,6 @@ function poll_more_choices_submit($form, &$form_state) { $form_state['rebuild'] = TRUE; } -/** - * Constructs one individual form choice as part of poll node form. - * - * @see poll_form() - */ function _poll_choice_form($key, $chid = NULL, $value = '', $votes = 0, $weight = 0, $size = 10) { $form = array( '#tree' => TRUE, @@ -423,10 +410,12 @@ function _poll_choice_form($key, $chid = NULL, $value = '', $votes = 0, $weight } /** - * Ajax callback for adding new choices to the poll node form. + * Ajax callback in response to new choices being added to the form. * * This returns the new page content to replace the page content made obsolete * by the form submission. + * + * @see poll_more_choices_submit() */ function poll_choice_js($form, $form_state) { return $form['choice_wrapper']['choice']; @@ -437,8 +426,6 @@ function poll_choice_js($form, $form_state) { * * Upon preview and final submission, we need to renumber poll choices and * create a teaser output. - * - * @see poll_teaser() */ function poll_node_form_submit($entity_type, $entity, &$form, &$form_state) { // Renumber choices. @@ -620,12 +607,10 @@ function poll_delete($node) { } /** - * Returns the content for the 'latest poll' block. + * Return content for 'latest poll' block. * * @param Drupal\node\Node $node * The node entity to load. - * - * @see poll_view_results() */ function poll_block_latest_poll_view(Node $node) { global $user; @@ -669,8 +654,6 @@ function poll_block_latest_poll_view(Node $node) { /** * Implements hook_view(). - * - * @see poll_view_results() */ function poll_view($node, $view_mode) { global $user; @@ -689,12 +672,6 @@ function poll_view($node, $view_mode) { * Creates a simple teaser that lists all the choices. * * This is primarily used for RSS. - * - * @param $node - * The poll node object. - * - * @return - * Poll choices in a simple teaser format. */ function poll_teaser($node) { $teaser = NULL; @@ -709,16 +686,11 @@ function poll_teaser($node) { } /** - * Form constructor for the poll voting form. + * Generates the voting form for a poll. * - * @param $node - * The poll node object. - * @param $block - * (optional) TRUE if a poll should be displayed in a block. Defaults to - * FALSE. - * @see phptemplate_preprocess_poll_vote() - * @see poll_vote() * @ingroup forms + * @see poll_vote() + * @see phptemplate_preprocess_poll_vote() */ function poll_view_voting($form, &$form_state, $node, $block = FALSE) { if ($node->choice) { @@ -755,9 +727,7 @@ function poll_view_voting($form, &$form_state, $node, $block = FALSE) { } /** - * Form validation handler for poll_view_voting(). - * - * @see poll_vote() + * Validation function for processing votes */ function poll_view_voting_validate($form, &$form_state) { if ($form_state['values']['choice'] == -1) { @@ -766,9 +736,7 @@ function poll_view_voting_validate($form, &$form_state) { } /** - * Form submission handler for poll_view_voting(). - * - * @see poll_view_voting_validate() + * Submit handler for processing a vote. */ function poll_vote($form, &$form_state) { $node = $form['#node']; @@ -817,7 +785,9 @@ function poll_preprocess_block(&$variables) { } /** - * Implements template_preprocess_HOOK() for poll-vote.tpl.php. + * Themes the voting form for a poll. + * + * Inputs: $form */ function template_preprocess_poll_vote(&$variables) { $form = $variables['form']; @@ -833,9 +803,6 @@ function template_preprocess_poll_vote(&$variables) { /** * Generates a graphical representation of the results of a poll. - * - * @see poll_block_latest_poll_view() - * @see poll_view() */ function poll_view_results($node, $view_mode, $block = FALSE) { // Make sure that choices are ordered by their weight. @@ -929,21 +896,13 @@ function theme_poll_choices($variables) { } /** - * Implements template_preprocess_HOOK() for poll-results.tpl.php. + * Preprocess the poll_results theme hook. * - * @param $variables - * An associative array containing: - * - raw_title: A string for the title of the poll. - * - results: The results of the poll. - * - votes: The total results in the poll. - * - raw_links: Array containing links in the poll. - * - block: A boolean to define if the poll is a block. - * - nid: The node ID of the poll. - * - vote: The choice number of the current user's vote. - * The raw_* inputs to this are naturally unsafe; often safe versions are - * made to simply overwrite the raw version, but in this case it seems likely - * that the title and the links may be overridden by the theme layer, so they - * are left in with a different name for that purpose. + * Inputs: $raw_title, $results, $votes, $raw_links, $block, $nid, $vote. The + * $raw_* inputs to this are naturally unsafe; often safe versions are + * made to simply overwrite the raw version, but in this case it seems likely + * that the title and the links may be overridden by the theme layer, so they + * are left in with a different name for that purpose. * * @see poll-results.tpl.php * @see poll-results--block.tpl.php @@ -958,10 +917,7 @@ function template_preprocess_poll_results(&$variables) { } /** - * Form constructor for the poll cancel form. - * - * @param $nid - * The poll node ID. + * Builds the cancel form for a poll. * * @ingroup forms * @see poll_cancel() @@ -983,7 +939,7 @@ function poll_cancel_form($form, &$form_state, $nid) { } /** - * Form submission handler for poll_cancel_form(). + * Submit callback for poll_cancel_form(). */ function poll_cancel($form, &$form_state) { global $user; diff --git a/core/modules/poll/poll.pages.inc b/core/modules/poll/poll.pages.inc index b67d8f9..e33dc1f 100644 --- a/core/modules/poll/poll.pages.inc +++ b/core/modules/poll/poll.pages.inc @@ -2,16 +2,11 @@ /** * @file - * Page callbacks for the Poll module. + * User page callbacks for the poll module. */ /** - * Page callback: Displays a simple list of all available polls. - * - * @return - * The HTML for the page that shows the available polls. - * - * @see poll_menu() + * Menu callback to provide a simple list of all polls available. */ function poll_page() { $polls_per_page = 15; @@ -52,17 +47,7 @@ function poll_page() { } /** - * Page callback: Displays the 'votes' tab for polls. - * - * This page displays a table containing each vote that has been cast. - * - * @param $node - * The poll node object. - * - * @return - * Render array containing table with votes. - * - * @see poll_menu() + * Callback for the 'votes' tab for polls you can see other votes on */ function poll_votes($node) { $votes_per_page = 20; @@ -106,17 +91,7 @@ function poll_votes($node) { } /** - * Page callback: Displays the 'results' tab for the current poll. - * - * This tab displays a summary of the votes that have been cast. - * - * @param $node - * The poll node object. - * - * @return - * An array suitable for use by drupal_render(). - * - * @see poll_menu() + * Callback for the 'results' tab for polls you can vote on */ function poll_results($node) { drupal_set_title($node->label());