You are here

function acquia_lift_get_option_set_for_targeting in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 acquia_lift.module \acquia_lift_get_option_set_for_targeting()

Get the option set where targeting rules are defined.

The assumption here is that if you have multiple option sets then targeting is only defined on one of them as we currently do not support targeting for MVTs.

Parameters

$agent: A stdClass object representing the agent to get the option set for.

Return value

stdClass|NULL The option set to use for targeting rules or NULL if the agent has no option sets.

11 calls to acquia_lift_get_option_set_for_targeting()
acquia_lift_add_new_test_for_audience in ./acquia_lift.admin.inc
Creates a new nested test of the specified variations for the specified agent.
acquia_lift_delete_old_nested_test in ./acquia_lift.admin.inc
Deletes a nested test that is no longer needed.
acquia_lift_new_target_audience_form_validate in ./acquia_lift.admin.inc
Validation callback for the new target audience form.
acquia_lift_remove_option_for_audience in ./acquia_lift.admin.inc
Unsets the option_id property for a given target audience.
acquia_lift_review_form in ./acquia_lift.admin.inc
Final review form for applying targeting changes.

... See full list

File

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

Code

function acquia_lift_get_option_set_for_targeting($agent_name) {
  $option_sets = personalize_option_set_load_by_agent($agent_name, TRUE);
  if (empty($option_sets)) {
    return NULL;
  }
  foreach ($option_sets as $option_set) {
    if (!empty($option_set->targeting)) {
      return $option_set;
    }
  }
  return reset($option_sets);
}