Commit a92c4590 authored by Lisa Backer's avatar Lisa Backer
Browse files

Issue #2283551 by eshta: separate auto-personalize context selection from fixed targeting.

parent e51bce70
Loading
Loading
Loading
Loading
+4 −0
Changes for css/personalize.admin.css: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ input[type="submit"].personalize-add-link {
  padding: 0;
  margin: 0;
  height: 2em;
  font-size: 1em;
  line-height: 2em;
  -moz-border-radius: 0;
  -webkit-border-radius: 0;
@@ -56,6 +57,9 @@ button.personalize-add-link:hover,
input[type="submit"].personalize-add-link:hover {
  background: transparent;
}
.personalize-admin-content-header input.personalize-add-link {
  font-size: inherit;
}
/* The + before the Add Goals button */
/* Link look alike styling for add a goal button */
.personalize-add-link-prefix:after {
+29 −4
Changes for includes/personalize.classes.inc: 29 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -168,6 +168,10 @@ interface PersonalizeAgentReportInterface {
  public function buildCampaignReports($decision_name = NULL, $date_from = NULL, $date_to = NULL);
}

/**
 * An interface to implement when an agent supports explicit targeting for
 * content variations.
 */
interface PersonalizeExplicitTargetingInterface extends PersonalizeAgentInterface {

  const EXPLICIT_TARGETING_MULTIPLE_OR = 1;
@@ -176,7 +180,7 @@ interface PersonalizeExplicitTargetingInterface extends PersonalizeAgentInterfac

  /**
   * Returns how this agent supports explicit targeting
   * with muliple features.
   * with multiple features.
   *
   * @return int
   *   Returns one of the above constants.
@@ -185,6 +189,25 @@ interface PersonalizeExplicitTargetingInterface extends PersonalizeAgentInterfac

}

/**
 * An interface to implement when an agent supports automatic targeting of
 * results based on campaign-specific targeting options.
 */
interface PersonalizeAutoTargetingInterface extends PersonalizeAgentInterface {

  /**
   * Indicates if explicit targeting options are dependent on the auto targeting
   * context options selected for the campaign.
   *
   * @return boolean
   *   True to indicate that explicit targeting values are dependent upon
   *   campaign auto-targeting options selected.  False to indicate that
   *   explicit targeting options are selected independently of campaign
   *   auto-targeting context options.
   */
  public static function constrainExplicitTargetingContexts();
}

/**
 * Abstract base class for agents, providing default implementations of some methods.
 */
@@ -408,12 +431,14 @@ interface PersonalizeContextInterface {
  /**
   * Returns the possible values that this context plugin could send as
   * feature strings.
   *
   * @param $limit
   *   True if values should be limited by the selected context; false to
   *   return all possible values regardless of selected context.
   * @return array
   *   An associative array of values with feature strings as keys and
   *   human-readable names as values.
   */
  public function getPossibleValues();
  public function getPossibleValues($limit = FALSE);

  /**
   * Returns the assets required for this context object to work.
@@ -485,7 +510,7 @@ abstract class PersonalizeContextBase implements PersonalizeContextInterface, Pe
  /**
   * Implements PersonalizeContextInterface::getPossibleValues().
   */
  public function getPossibleValues() {
  public function getPossibleValues($limit = FALSE) {
    return array();
  }
}
+1 −1
Changes for js/personalize.js: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -635,7 +635,7 @@
   *   An object representing an option sett.
   */
  function processOptionSet(option_set) {
    // Bail if this option set has already been processeed.
    // Bail if this option set has already been processed.
    for (var i in processedOptionSets) {
      if (option_set.osid == processedOptionSets[i]) {
        return;
+7 −3
Changes for modules/personalize_url_context/plugins/visitor_context/QuerystringContext.inc: 7 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -56,11 +56,12 @@ class QuerystringContext extends PersonalizeContextBase {
  }

  /**
   * Implements PersonalizeAgentInterface::getPossibleValues().
   * Implements PersonalizeContextInterface::getPossibleValues().
   */
  public function getPossibleValues() {
  public function getPossibleValues($limit = FALSE) {
    $possible_values = array();
    foreach ($this->selectedContext as $name) {
    $options = $this->getOptions();
    foreach ($options as $name => $info) {
      $possible_values[$name] = array(
        'value type' => 'string',
      );
@@ -74,6 +75,9 @@ class QuerystringContext extends PersonalizeContextBase {
      'value type' => 'string',
      'friendly name' => t('First referrer'),
    );
    if ($limit) {
      $possible_values = array_intersect_key($possible_values, array_flip($this->selectedContext));
    }
    return $possible_values;
  }
}
+1 −1
Changes for modules/personalize_url_context/tests/personalize_url_context.test: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ class PersonalizeUrlContextTest extends DrupalWebTestCase {
    $agent = personalize_agent_load_agent('test-agent');
    $context_plugin = call_user_func_array(array($class, 'create'), array($agent, array('param2', 'param3')));
    $expected_values = array();
    foreach (array('param2', 'param3') as $name) {
    foreach (array('some-param', 'param2', 'param3') as $name) {
      $expected_values[$name] = array(
        'value type' => 'string'
      );
Loading