You are here

public function WebformConditionals::componentVisibility in Webform 7.4

Returns the required status for a component.

Returns whether a given component is always hidden, always shown, or might be shown depending upon other sources on the same page.

Assumes that the conditionals have already been executed on the given page.

Parameters

int $cid: The component id of the component whose visibility is being sought.

int $page_num: The page number that the component is on.

Return value

int self::componentHidden, ...Shown, or ...Dependent.

1 call to WebformConditionals::componentVisibility()
WebformConditionals::pageVisibility in includes/webform.webformconditionals.inc
Returns whether a given page should be displayed.

File

includes/webform.webformconditionals.inc, line 530
Conditional engine to process dependencies within the webform's conditionals.

Class

WebformConditionals
Performs analysis and topological sorting on the conditionals.

Code

public function componentVisibility($cid, $page_num) {
  if (!$this->visibilityMap) {

    // The conditionals have not yet been executed on a submission.
    $this
      ->executeConditionals(array(), 0);
    watchdog('webform', 'WebformConditionals::componentVisibility called prior to evaluating a submission.', array(), WATCHDOG_ERROR);
  }
  return isset($this->visibilityMap[$page_num][$cid]) ? $this->visibilityMap[$page_num][$cid] : self::componentShown;
}