You are here

protected function AcquiaLiftReport::buildReportContextSelection in Acquia Lift Connector 7

Returns a form input array for the context selector.

Parameters

array $report_data: Reporting data for the selected dates and decision.

Return value

array A render array representing the variation set report.

1 call to AcquiaLiftReport::buildReportContextSelection()
AcquiaLiftReport::buildCampaignReports in plugins/agent_types/AcquiaLiftAgent.inc
Implements PersonalizeAgentReportInterface::buildCampaignReports().

File

plugins/agent_types/AcquiaLiftAgent.inc, line 2623
Provides an agent type for Acquia Lift

Class

AcquiaLiftReport
Responsible retrieving and generating reports on the Acquia Lift agent.

Code

protected function buildReportContextSelection($report_data) {
  if ($report_data['potential_context'] === FALSE || $report_data['targeting'] === FALSE) {
    return array();
  }
  $context_values = array();
  foreach ($report_data['targeting'] as $code => $feature) {
    if ($feature['system'] === TRUE) {
      continue;
    }
    if (isset($report_data['potential_context'][$code])) {
      $type = empty($report_data['potential_context'][$code]['type']) ? t('Other') : $report_data['potential_context'][$code]['type'];
      $context_values[$type][$code] = $report_data['potential_context'][$code]['name'];
    }
    else {
      $type = t('Other');
      $context_values[$type][$code] = $code;
    }
  }
  if (count($context_values) <= 1) {
    return array();
  }
  return array(
    '#title' => t('Context: '),
    '#type' => 'select',
    '#options' => $context_values,
    '#multiple' => TRUE,
  );
}