function acquia_lift_page_variation_rename in Acquia Lift Connector 7
Rename a page variation.
To rename a page variation, re-label all options that match the variation.
Parameters
string $variation_set_name: The name of the variation set that this variation belongs to.
string $agent_name: The name of the campaign/agent for this page variation.
number $variation_number: The number of variation within the variation set to rename
string $variation_name: The new variation name.
2 calls to acquia_lift_page_variation_rename()
- AcquiaLiftWebTestVariationSets::testVariationSets in tests/
acquia_lift.test - Tests variation set creation.
- acquia_lift_page_variation_rename_form_submit in ./
acquia_lift.admin.unibar.inc - Submit handler for acquia_lift_page_variation_rename_form().
File
- ./
acquia_lift.page_variations.inc, line 127 - acquia_lift.admin.page_variations.inc
Code
function acquia_lift_page_variation_rename($variation_set_name, $agent_name, $variation_number, $variation_name) {
// Cannot rename the control variation.
if ($variation_number == 0) {
return;
}
$option_sets = personalize_option_set_load_multiple(FALSE, array(
'decision_name' => $variation_set_name,
'agent' => $agent_name,
));
foreach ($option_sets as $option_set) {
if (isset($option_set->options[$variation_number])) {
$option_set->options[$variation_number]['option_label'] = $variation_name;
personalize_option_set_save($option_set);
}
}
}