You are here

public static function AcquiaLiftContext::create in Acquia Lift Connector 7

Implements PersonalizeContextInterface::create().

File

plugins/visitor_context/AcquiaLiftContext.inc, line 12
Provides an agent type for Acquia Lift

Class

AcquiaLiftContext
@file Provides an agent type for Acquia Lift

Code

public static function create(PersonalizeAgentInterface $agent = NULL, $selected_context = array()) {
  if ($agent === NULL) {
    throw new AcquiaLiftException('Cannot use Lift contexts outside the context of an agent');
  }
  try {
    $lift_api = AcquiaLiftAPI::getInstance(variable_get('acquia_lift_account_info', array()));
    return new self($agent, $selected_context, $lift_api);
  } catch (AcquiaLiftException $e) {
    watchdog('Acquia Lift', 'Unable to instantiate Acquia Lift Agent');
    return NULL;
  }
}