You are here

function acquia_lift_set_option_for_audience in Acquia Lift Connector 7.2

Same name and namespace in other branches
  1. 7 acquia_lift.admin.inc \acquia_lift_set_option_for_audience()

Assigns an option to a target audience.

Parameters

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

$option_id: The option ID

$audience: The name of hte targeting audience to assign the option to.

Throws

\PersonalizeException

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

Code

function acquia_lift_set_option_for_audience(&$option_set, $option_id, $audience) {
  if (isset($option_set->targeting[$audience])) {

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