You are here

function views_gantt_get_style_options in Views Gantt 7.2

Same name and namespace in other branches
  1. 7 views_gantt.module \views_gantt_get_style_options()

Get style plugin options.

1 call to views_gantt_get_style_options()
views_gantt_update in ./views_gantt.module
Callback for task/project update when we change it in Gantt chart.

File

./views_gantt.module, line 286
Module file for Views Gantt

Code

function views_gantt_get_style_options($view_name) {
  $view = views_get_view($view_name);

  // Get style plugin options.
  // Some fields in $this->options can have incorrect names (e.g. field_date_1),
  // so we should check the real field name.
  $style_options = array();
  foreach ($view->display as $display) {
    $display_options = $display->display_options;
    if (isset($display_options['style_plugin']) && $display_options['style_plugin'] == 'gantt') {
      $style_options = $display->display_options['style_options'];
      foreach ($style_options as $key => &$value) {
        if (!empty($value) && !is_array($value) && isset($display->display_options['fields'][$value])) {
          $value = $display->display_options['fields'][$value]['field'];
        }
      }
      break;
    }
  }
  return $style_options;
}