function _ip_geoloc_plugin_style_differentiator_color_table_form in IP Geolocation Views & Maps 7
Same name and namespace in other branches
- 8 src/Plugin/views/style/ip_geoloc_plugin_style.inc \_ip_geoloc_plugin_style_differentiator_color_table_form()
Plugin style color differ.
1 call to _ip_geoloc_plugin_style_differentiator_color_table_form()
- 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 385 - ip_geoloc_plugin_style.inc
Code
function _ip_geoloc_plugin_style_differentiator_color_table_form(&$form, &$form_state) {
$is_openlayers = $form_state['renderer'] == 'openlayers';
// First the saved rows...
// @todo: if $field['cardinality'] > 1, compress multiple diff. values
// for the same color together in a single row.
$view_id = $form_state['view']->name;
$display_id = $form_state['display_id'];
$differentiator = $form_state['differentiator'];
$diff_color_ass = variable_get('ip_geoloc_' . $view_id . '_color_mappings', array());
if (empty($diff_color_ass[$display_id][$differentiator])) {
$diff_color_ass[$display_id] = array(
$differentiator => array(),
);
}
$row = 0;
foreach ($diff_color_ass[$display_id][$differentiator] as $association) {
if (!is_array($association)) {
// Data corrupt.
break;
}
if (isset($form_state['num_associations']) && $row >= $form_state['num_associations']) {
break;
}
$form['differentiator']['color_table'][$row] = _ip_geoloc_plugin_style_diff_color_table_row_form($is_openlayers, $row, $differentiator, $association);
$row++;
}
// ... then the empty rows.
if (!isset($form_state['num_associations'])) {
$form_state['num_associations'] = count($diff_color_ass[$display_id][$differentiator]);
}
while ($row < $form_state['num_associations']) {
$form['differentiator']['color_table'][$row] = _ip_geoloc_plugin_style_diff_color_table_row_form($is_openlayers, $row, $differentiator);
$row++;
}
}