You are here

protected function RulesConditionalCase::setUpCondition in Conditional Rules 7

Same name and namespace in other branches
  1. 8 includes/rules_conditional.plugin.inc \RulesConditionalCase::setUpCondition()
1 call to RulesConditionalCase::setUpCondition()
RulesConditionalCase::forceSetUp in includes/rules_conditional.plugin.inc
Forces the object to be setUp, this executes setUp() if not done yet.

File

includes/rules_conditional.plugin.inc, line 315
Rules plugin implementation.

Class

RulesConditionalCase
Switch case.

Code

protected function setUpCondition() {
  if (!isset($this->condition) && isset($this->parent)) {

    // Prepare settings for 'data_is' condition.
    $settings = array(
      'data:select' => $this->parent->settings['data:select'],
      'op' => '==',
    );
    if (isset($this->settings['value:select'])) {
      $settings['value:select'] = $this->settings['value:select'];
    }
    elseif (isset($this->settings['value'])) {
      $settings['value'] = $this->settings['value'];
    }
    else {

      // Abort if settings are incomplete.
      return;
    }

    // Set up 'data_is'.
    $this->condition = rules_condition('data_is', $settings);
    $this->condition->parent = $this;
    $this->condition
      ->processSettings();
  }
}