function RulesPlugin::integrityCheck

Makes sure the plugin is configured right.

"Configured right" means all needed variables are available in the element's scope and dependent modules are enabled.

Return value

$this

Throws

RulesIntegrityException In case of a failed integrity check, a RulesIntegrityException exception is thrown.

2 calls to RulesPlugin::integrityCheck()
RulesAbstractPlugin::integrityCheck in includes/rules.core.inc
Makes sure the plugin is configured right.
RulesContainerPlugin::integrityCheck in includes/rules.core.inc
2 methods override RulesPlugin::integrityCheck()
RulesAbstractPlugin::integrityCheck in includes/rules.core.inc
Makes sure the plugin is configured right.
RulesContainerPlugin::integrityCheck in includes/rules.core.inc

File

includes/rules.core.inc, line 883

Class

RulesPlugin
Base class for rules plugins.

Code

public function integrityCheck() {
  // First process the settings if not done yet.
  $this->processSettings();
  // Check dependencies using the pre-calculated dependencies stored in
  // $this->dependencies. Fail back to calculation them on the fly, e.g.
  // during creation.
  $dependencies = empty($this->dependencies) ? $this->dependencies() : $this->dependencies;
  foreach ($dependencies as $module) {
    if (!module_exists($module)) {
      throw new RulesDependencyException(t('Missing required module %name.', array(
        '%name' => $module,
      )));
    }
  }
  // Check the parameter settings.
  $this->checkParameterSettings();
  // Check variable names for provided variables to be valid.
  foreach ($this->pluginProvidesVariables() as $name => $info) {
    if (isset($this->settings[$name . ':var'])) {
      $this->checkVarName($this->settings[$name . ':var']);
    }
  }
  return $this;
}