You are here

function views_content_views_panes_content_type_admin_info in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 views_content/plugins/content_types/views_panes.inc \views_content_views_panes_content_type_admin_info()

Returns the administrative title for a type.

File

views_content/plugins/content_types/views_panes.inc, line 604
Content type plugin to allow Views to be exposed as a display type, leaving most of the configuration on the view.

Code

function views_content_views_panes_content_type_admin_info($subtype, $conf, $contexts) {
  $info = array();
  list($view_name, $display_name) = explode('-', $subtype);
  $view = views_get_view($view_name);
  if (empty($view) || empty($view->display[$display_name])) {
    return;
  }
  $view
    ->set_display($display_name);
  views_content_views_panes_add_defaults($conf, $view);

  // Add arguments first.
  if (!empty($conf['arguments'])) {
    $keys = array_keys($conf['arguments']);
    $values = array_values($conf['arguments']);
    $argument_input = $view->display_handler
      ->get_option('argument_input');
    foreach ($conf['arguments'] as $key => $value) {
      if (!empty($value)) {
        $label = $argument_input[$key]['label'];
        $info[] = $label . ': ' . $value;
      }
    }
  }
  $block = new stdClass();
  if ($info) {
    $block->title = array_shift($info);
    $info[] = $view->display_handler
      ->get_option('pane_description');
    $block->content = theme('item_list', array(
      'items' => $info,
    ));
  }
  else {
    $block->title = $view->display_handler
      ->get_option('pane_description');
    $block->content = '';
  }
  return $block;
}