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
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | webform-clarify-webform-get-cid-phpdoc-2826555-2.patch | 1 KB | mccrodp |
Comments
Comment #2
mccrodp commentedComment #4
liam morlandComment #5
liam morland