You are here

function rules_scheduler_action_schedule_validate in Rules 7.2

Validate callback for the schedule action.

Makes sure the component exists and is not dirty.

See also

rules_element_invoke_component_validate()

Related topics

File

rules_scheduler/rules_scheduler.rules.inc, line 125
Rules integration for the rules scheduler module.

Code

function rules_scheduler_action_schedule_validate(RulesPlugin $element) {
  $info = $element
    ->info();
  $component = rules_config_load($element->settings['component']);
  if (!$component) {
    throw new RulesIntegrityException(t('The component %config does not exist.', array(
      '%config' => $element->settings['component'],
    )), $element);
  }

  // Check if the component is marked as dirty.
  rules_config_update_dirty_flag($component);
  if (!empty($component->dirty)) {
    throw new RulesIntegrityException(t('The utilized component %config fails the integrity check.', array(
      '%config' => $element->settings['component'],
    )), $element);
  }
}