public function FlotTime::sanitizeColumns in Flot 8
1 call to FlotTime::sanitizeColumns()
- FlotTime::buildOptionsForm in flot_views_time/
src/ Plugin/ views/ style/ FlotTime.php - Provide a form to edit options for this plugin.
File
- flot_views_time/
src/ Plugin/ views/ style/ FlotTime.php, line 39
Class
- FlotTime
- Style plugin to render dates and values as a bar, scatter, or line chart.
Namespace
Drupal\flot_views_time\Plugin\views\styleCode
public function sanitizeColumns($columns, $fields = NULL) {
$sanitized = array();
if ($fields === NULL) {
$fields = $this->displayHandler
->getOption('fields');
}
// Preconfigure the sanitized array so that the order is retained.
foreach ($fields as $field => $info) {
// Set to itself so that if it isn't touched, it gets column
// status automatically.
$sanitized[$field] = $field;
}
foreach ($columns as $field => $column) {
// first, make sure the field still exists.
if (!isset($sanitized[$field])) {
continue;
}
// If the field is the column, mark it so, or the column
// it's set to is a column, that's ok
if ($field == $column || $columns[$column] == $column && !empty($sanitized[$column])) {
$sanitized[$field] = $column;
}
// Since we set the field to itself initially, ignoring
// the condition is ok; the field will get its column
// status back.
}
return $sanitized;
}