Problem/Motivation

The current phpdoc comments are incorrect and confusing in webform_get_cid.

Given a form_key and a list of form_key parents, determine the cid.

It should be "Given a form_key and a form_key parent, determine the cid."

The params are also incorrect. The coincides with parent issue where a new fn is added to gather all cids regardless of parent: #2825711: Change webform_get_cid() to allow it to return all cids for a given form_key.

Proposed resolution

Change comment block to:

/**
 * Given a form_key and a form_key parent, determine the cid.
 *
 * @param $node
 *   A fully loaded node object.
 * @param $form_key
 *   The form key for which we're finding a cid.
 * @param $pid
 *   The cid of the parent component.
 * @return int|string
 */
function webform_get_cid(&$node, $form_key, $pid) {
  foreach ($node->webform['components'] as $cid => $component) {
    if ($component['form_key'] == $form_key && $component['pid'] == $pid) {
      return $cid;
    }
  }
}

Remaining tasks

Provide patch

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Comments

mccrodp created an issue. See original summary.

mccrodp’s picture

Status: Active » Needs review
StatusFileSize
new1 KB

  • Liam Morland committed b702cdc on 7.x-4.x
    Issue #2826555 by mccrodp, Liam Morland: Correct comments for...
liam morland’s picture

Status: Needs review » Fixed
liam morland’s picture

Component: Code » Documentation

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.