You are here

function oa_core_views_copy_get_arguments_to_link in Open Atrium Core 7.2

Copies GET arguments to the end of a link on a view.

Should be used in hook_views_pre_view().

Parameters

object &$view: Views object to modify.

string $display_name: (Optional) The Views display to modify.

string $field_name: (Optional) The Views field name to modify.

See also

hook_views_pre_view()

2 calls to oa_core_views_copy_get_arguments_to_link()
oa_core_views_pre_view in ./oa_core.module
Implements hook_views_pre_view().
oa_sections_views_pre_view in modules/oa_sections/oa_sections.module
Implements hook_views_pre_view().

File

./oa_core.module, line 1130

Code

function oa_core_views_copy_get_arguments_to_link(&$view, $display_name = 'default', $field_name = 'name') {

  // Get the GET arguments from the current page.
  $args = $_GET;
  unset($args['q']);
  if (count($args) > 0) {
    $query = http_build_query($args);
    if (!empty($view->display[$display_name]->handler->options['fields'][$field_name]['alter']['path'])) {
      $view->display[$display_name]->handler->options['fields'][$field_name]['alter']['path'] .= '?' . $query;
    }
  }
}