You are here

function global_filter_block_view in Views Global Filter 6

Same name and namespace in other branches
  1. 8 global_filter.blocks.inc \global_filter_block_view()
  2. 7 global_filter.blocks.inc \global_filter_block_view()
2 calls to global_filter_block_view()
global_filter_block in ./global_filter.blocks.inc
Implements hook_block().
global_filter_views_pre_view in ./global_filter.module
Implements hook_views_pre_view().

File

./global_filter.blocks.inc, line 137
global_filter.block.inc

Code

function global_filter_block_view($delta) {
  $block = array();
  $filter_name = variable_get($delta, '');
  if (drupal_substr($filter_name, 0, 4) == 'view') {
    $all_views = global_filter_get_view_names();
    $block['subject'] = drupal_substr($all_views[$filter_name], 6);
  }
  elseif (!empty($filter_name)) {
    $all_filters = global_filter_get_node_properties();

    //@tobeported $all_filters = array_merge(global_filter_get_node_properties(), global_filter_get_field_labels());
    $label = $all_filters[$filter_name];
    $pos_colon = strpos($label, ':');
    $pos_bracket = strrpos($label, '(');
    $block['subject'] = drupal_substr($label, $pos_colon + 2, $pos_bracket > $pos_colon ? $pos_bracket - $pos_colon - 3 : NULL);
  }
  $block['content'] = drupal_get_form($delta);

  // $delta becomes id="global-filter-2" on form
  return $block;
}