You are here

function views_data_export_plugin_style_export::build_sort in Views data export 7.4

Same name and namespace in other branches
  1. 6.3 plugins/views_data_export_plugin_style_export.inc \views_data_export_plugin_style_export::build_sort()
  2. 6 plugins/views_data_export_plugin_style_export.inc \views_data_export_plugin_style_export::build_sort()
  3. 6.2 plugins/views_data_export_plugin_style_export.inc \views_data_export_plugin_style_export::build_sort()
  4. 7 plugins/views_data_export_plugin_style_export.inc \views_data_export_plugin_style_export::build_sort()
  5. 7.3 plugins/views_data_export_plugin_style_export.inc \views_data_export_plugin_style_export::build_sort()

Called by the view builder to see if this style handler wants to interfere with the sorts. If so it should build; if it returns any non-TRUE value, normal sorting will NOT be added to the query.

Overrides views_plugin_style::build_sort

File

plugins/views_data_export_plugin_style_export.inc, line 206
Plugin include file for export style plugin.

Class

views_data_export_plugin_style_export
Generalized style plugin for export plugins.

Code

function build_sort() {

  // Bypass doing any sort of testing if parent sorting is disabled.
  if (!$this->options['parent_sort']) {
    return parent::build_sort();
  }
  $displays = $this->display->handler
    ->get_option('displays');

  // Here is later. We can get the passed argument and use it to know which
  // display we can from and then do some addition processing.
  // If the display exists and is attached these two tests will succeed.
  if (isset($_GET['attach']) && isset($displays[$_GET['attach']]) && $displays[$_GET['attach']]) {

    // Setup the second style we're going to be using to sort on.
    $plugin_id = $displays[$_GET['attach']];
    $parent_display = $this->view->display[$plugin_id];
    $style_name = $parent_display->handler
      ->get_option('style_plugin');
    $style_options = $parent_display->handler
      ->get_option('style_options');
    $this->extra_style = views_get_plugin('style', $style_name);
    $this->extra_style
      ->init($this->view, $parent_display, $style_options);

    // Call the second styles sort function and return the value.
    return $this->extra_style
      ->build_sort();
  }
}