function acquia_lift_personalize_elements_form_validate in Acquia Lift Connector 7.2
Validation handler for personalize_elements_form.
1 string reference to 'acquia_lift_personalize_elements_form_validate'
File
- ./
acquia_lift.module, line 2718 - acquia_lift.module Provides Acquia Lift-specific personalization functionality.
Code
function acquia_lift_personalize_elements_form_validate(&$form, &$form_state) {
if (!isset($form_state['values']['agent_select'])) {
return;
}
$agent = $form_state['values']['agent_select'];
$agent_data = personalize_agent_load($agent);
if ($agent_data->plugin !== 'acquia_lift_target') {
return;
}
module_load_include('inc', 'acquia_lift', 'acquia_lift.admin');
if (acquia_lift_target_definition_changes_allowed($agent_data)) {
return;
}
// Variations cannot be removed from running acquia_lift_target campaigns if
// they are used in targeting.
foreach ($form_state['values']['options'] as $delta => $option) {
if (empty($option['personalize_elements_content']) && !empty($option['option_id'])) {
if (acquia_lift_target_option_targeted($agent, $option['option_id'])) {
form_set_error('options][' . $delta . '][personalize_elements_content', t('Variations cannot be removed until the %campaign_name personalization is paused.', array(
'%campaign_name' => $agent_data->label,
)));
}
}
}
}