You are here

public function AcquiaLiftTarget::getMultipleOptionSetErrors in Acquia Lift Connector 7.2

Determine the error messaging to show based on multiple variation set handling configuration for the current agent.

Parameters

$option_sets: The option sets to check based on this agent's configuration.

Return value

array An array of error messages to display which will be empty if there are no errors.

1 call to AcquiaLiftTarget::getMultipleOptionSetErrors()
AcquiaLiftTarget::errors in plugins/agent_types/AcquiaLiftTarget.inc
Implements PersonalizeAgentInterface::errors().

File

plugins/agent_types/AcquiaLiftTarget.inc, line 163
Provides an agent for doing fixed targeting.

Class

AcquiaLiftTarget
@file Provides an agent for doing fixed targeting.

Code

public function getMultipleOptionSetErrors($option_sets) {
  $data = $this
    ->getData();
  $is_mvt = isset($data['variation_set_handling']) && $data['variation_set_handling'] == ACQUIA_LIFT_DECISION_MULTIVARIATE;
  $count_os = count($option_sets);
  $errors = array();
  if ($is_mvt) {
    if ($count_os < 2) {
      $errors[] = t('A multi-variate test requires at least two option sets. Please add another variation set in the <a href="!what_url">"What" section</a>.', array(
        '!what_url' => url('admin/structure/personalize/manage/' . $this
          ->getMachineName() . '/variations'),
      ));
    }
  }
  if (count($option_sets) > 1) {

    // If there are multiple option sets, check that they all have the same number
    // of options.
    if (!acquia_lift_target_validate_lock_step($option_sets)) {

      // @todo Get proper text for this.
      $errors[] = t('You have multiple variation sets with different numbers of variations. The personalization cannot be started until all variation sets have the same number of variations. Fix this in the <a href="!what_url">%section section</a>.', array(
        '!what_url' => url('admin/structure/personalize/manage/' . $this
          ->getMachineName() . '/variations'),
        '%section' => t('What'),
      ));
    }
  }
  return $errors;
}