You are here

function acquia_lift_remove_nested_test in Acquia Lift Connector 7.2

Removes a nested test from an audience.

This does not actually delete the test - it is kept around so that reports can be viewed, but the test is removed from the audience.

Parameters

$option_set: The option set whose targeting is being changed.

$audience: THe name of the target audience the test was assigned to.

Throws

\PersonalizeException

1 call to acquia_lift_remove_nested_test()
acquia_lift_implement_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 1888
acquia_lift.admin.inc Provides functions needed for the admin UI.

Code

function acquia_lift_remove_nested_test(&$option_set, $audience, $parent_agent) {

  // Find the nested option set for the specified targeting rule.
  if (isset($option_set->targeting[$audience]) && isset($option_set->targeting[$audience]['osid'])) {
    $nested_os = personalize_option_set_load($option_set->targeting[$audience]['osid']);

    // Retire the test.
    $nested_agent = personalize_agent_load($nested_os->agent);
    $audience_label = isset($option_set->targeting[$audience]['label']) ? $option_set->targeting[$audience]['label'] : $audience;
    acquia_lift_retire_test($nested_agent, $parent_agent->machine_name, $parent_agent->label, $audience, $audience_label);
    unset($option_set->targeting[$audience]['osid']);
  }
}