function theme_ip_geoloc_plugin_style_differentiator_color_table in IP Geolocation Views & Maps 7
Same name and namespace in other branches
- 8 src/Plugin/views/style/ip_geoloc_plugin_style.inc \theme_ip_geoloc_plugin_style_differentiator_color_table()
Return HTML for differentiator to color associations table.
Parameters
array $variables: An associative array containing $variables['form']: a render element representing the form.
1 theme call to theme_ip_geoloc_plugin_style_differentiator_color_table()
- ip_geoloc_plugin_style_bulk_of_form in views/
ip_geoloc_plugin_style.inc - The bulk of the plugin style form.
File
- views/
ip_geoloc_plugin_style.inc, line 538 - ip_geoloc_plugin_style.inc
Code
function theme_ip_geoloc_plugin_style_differentiator_color_table($variables) {
// Use the first form child to find out the name of the differentiator.
$form = $variables['form'];
$form_children = element_children($form);
if (empty($form_children)) {
return '';
}
$key = reset($form_children);
foreach ($form[$key] as $attribute_name => $element) {
if (drupal_substr($attribute_name, 0, 1) != '#' && $attribute_name != 'color') {
$differentiator = $attribute_name;
break;
}
}
if (empty($differentiator)) {
return '';
}
$instances = ip_geoloc_get_field_instances($differentiator);
$instance = reset($instances);
$differentiator_label = isset($instance) ? $instance['label'] : $differentiator;
$headers = array(
t('%differentiator value', array(
'%differentiator' => $differentiator_label,
)),
t('Associated style/color'),
t('Font icon character'),
t('Font icon class'),
);
$rows = array();
foreach ($form_children as $key) {
$row = array(
'data' => array(),
'class' => array(),
);
$row['data'][] = drupal_render($form[$key][$differentiator]);
$row['data'][] = drupal_render($form[$key]['color']);
$row['data'][] = drupal_render($form[$key]['special char']);
$row['data'][] = drupal_render($form[$key]['special char class']);
$rows[] = $row;
}
$output = theme('table', array(
'header' => $headers,
'rows' => $rows,
'attributes' => array(
'id' => 'differentiator-color-table',
),
));
$output .= drupal_render_children($form);
return $output;
}