You are here

function acquia_lift_remove_option_for_audience in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 acquia_lift.admin.inc \acquia_lift_remove_option_for_audience()

Unsets the option_id property for a given target audience.

Parameters

$agent:

$audience:

Throws

\PersonalizeException

1 call to acquia_lift_remove_option_for_audience()
acquia_lift_update_targeting in ./acquia_lift.admin.inc
Takes whatever is in the 'lift_targeting' data property and converts it into the required campaign structure (including nested tests where needed).

File

./acquia_lift.admin.inc, line 1570
acquia_lift.admin.inc Provides functions needed for the admin UI.

Code

function acquia_lift_remove_option_for_audience($agent, $audience) {
  $option_set = acquia_lift_get_option_set_for_targeting($agent->machine_name);
  if (isset($option_set->targeting[$audience])) {

    // If there was a test assigned to this audience, remove it.
    if (isset($option_set->targeting[$audience]['option_id'])) {
      unset($option_set->targeting[$audience]['option_id']);
      personalize_option_set_save($option_set);
    }
  }
}