public function WebformConditionals::componentRequired in Webform 7.4
Returns the required status for a component.
Returns whether a given component is always required, always optional, or unchanged by conditional logic.
Assumes that the conditionals have already been executed on the given page.
Parameters
int $cid: The component id of the component whose required state is being sought.
int $page_num: The page number that the component is on.
Return value
bool Whether the component is required based on conditionals.
File
- includes/
webform.webformconditionals.inc, line 584 - Conditional engine to process dependencies within the webform's conditionals.
Class
- WebformConditionals
- Performs analysis and topological sorting on the conditionals.
Code
public function componentRequired($cid, $page_num) {
if (!$this->requiredMap) {
// The conditionals have not yet been executed on a submission.
$this
->executeConditionals(array(), 0);
watchdog('webform', 'WebformConditionals::componentRequired called prior to evaluating a submission.', array(), WATCHDOG_ERROR);
}
return isset($this->requiredMap[$page_num][$cid]) ? $this->requiredMap[$page_num][$cid] : NULL;
}