function WebformCalculationComponentsFormTree::getPid in Webform Calculation Components 7
Same name and namespace in other branches
- 7.2 WebformCalculationComponentsFormTree.php \WebformCalculationComponentsFormTree::getPid()
Gets the pid (Parent Id) of the calculation component.
Parameters
array $components: The array of components in a tree shape taken from the webform node form array.
string $form_key: The form key string to get the cid (Component Id), and then the pid.
boolean $include_fieldset: Because webform allows that a fieldset and another component shares the same form_key, most of the times we have to check that the component type is not a fieldset, that is why this parameter is set to false by default.
Return value
string It returns the pid string.
1 call to WebformCalculationComponentsFormTree::getPid()
- WebformCalculationComponentsFormTree::getOperationData in ./
WebformCalculationComponentsFormTree.php - Builds up an array with the necessary data of the calculation elements.
File
- ./
WebformCalculationComponentsFormTree.php, line 101 - Handles the arrays passed in the webform node.
Class
- WebformCalculationComponentsFormTree
- @file Handles the arrays passed in the webform node.
Code
function getPid(array $components, $form_key, $include_fieldset = FALSE) {
foreach ($components as $component) {
if ($component['form_key'] == $form_key) {
if ($include_fieldset == FALSE && $component['type'] != 'fieldset' || $include_fieldset == TRUE) {
return $component['pid'];
}
}
}
}