function theme_acquia_lift_type_list in Acquia Lift Connector 7
Same name and namespace in other branches
- 7.2 theme/acquia_lift.theme.inc \theme_acquia_lift_type_list()
Theme function for a type selection list.
This is used by the campaign A/B flow to allow a wizard-like selection of campaign types and goal types.
Parameters
$variables: An associative array of variables including:
- items: An array of types with the following keys
- type: What to display for the type
- description: What to display as the description of the type
- url: The url to create a new item of that type.
- logo: Logo to denote the type.
- modal: true if url should continue in a modal, false if a new page
- ctools_style: The ctools modal style to use for the next url (if modal = true).
- id: An optional id to use for the wrapping container element.
3 theme calls to theme_acquia_lift_type_list()
- acquia_lift_campaign_create_modal_callback in ./
acquia_lift.admin.unibar.inc - Page callback to start the create a campaign process. The first step is to select the type of
- acquia_lift_goal_create_modal_callback in ./
acquia_lift.admin.unibar.inc - Page callback to create a new goal by selecting the type of goal to create.
- acquia_lift_option_set_add_modal_callback in ./
acquia_lift.admin.unibar.inc - Page callback to create a new option set.
File
- theme/
acquia_lift.theme.inc, line 275 - acquia_lift.theme.inc Provides theme functions for Acquia Lift.
Code
function theme_acquia_lift_type_list($variables) {
ctools_include('modal');
ctools_include('ajax');
ctools_modal_add_js();
drupal_add_library('system', 'drupal.ajax');
$items = $variables['items'];
$html = '<div';
if (!empty($variables['id'])) {
$html .= ' id="' . $variables['id'] . '"';
}
$html .= ' class="acquia-lift-type-list">';
foreach ($items as $typestr => $type) {
$html .= '<div class="acquia-lift-type clearfix">';
$html .= '<div class="acquia-lift-type-logo">' . $type['logo'] . '</div>';
$html .= '<div class="acquia-lift-type-title">';
$url_options = isset($type['url_options']) ? $type['url_options'] : array();
if ($type['modal']) {
$path_parts = explode('/', $type['path']);
$last = end($path_parts);
if ($last != 'nojs') {
$path_parts[] = 'nojs';
}
$type['path'] = implode('/', $path_parts);
// We can't use ctools_modal_text_button here because it doesn't give us control
// over the options array and we need to be able to add query parameters to the link.
$url_options = array_merge_recursive($url_options, array(
'html' => TRUE,
'attributes' => array(
'class' => array(
'ctools-use-modal',
'acquia-lift-type-select',
$type['ctools_style'],
),
'title' => $type['title'],
),
));
}
else {
$url_options = array_merge_recursive($url_options, array(
'attributes' => array(
'class' => array(
'acquia-lift-type-select',
),
),
));
}
$html .= l($type['title'], $type['path'], $url_options);
$html .= '</div>';
$html .= '<p>' . $type['description'] . '</p>';
$html .= '</div>';
}
$html .= '</div>';
return $html;
}