function rules_element_invoke_component_validate

Validate callback to make sure the invoked component exists and is not dirty.

See also

rules_scheduler_action_schedule_validate()

Related topics

File

modules/rules_core.rules.inc, line 297

Code

function rules_element_invoke_component_validate(RulesPlugin $element) {
    $info = $element->info();
    $component = rules_config_load($info['#config_name']);
    // Check if a component exists.
    if (!$component) {
        throw new RulesIntegrityException(t('The component %config does not exist.', array(
            '%config' => $info['#config_name'],
        )), $element);
    }
    // Check if a 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' => $info['#config_name'],
        )), $element);
    }
}