You are here

function _views_content_panes_content_type in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 views_content/plugins/content_types/views_panes.inc \_views_content_panes_content_type()
2 calls to _views_content_panes_content_type()
views_content_views_panes_content_type_content_type in views_content/plugins/content_types/views_panes.inc
Return a single content type.
views_content_views_panes_content_type_content_types in views_content/plugins/content_types/views_panes.inc
Return all content types available.

File

views_content/plugins/content_types/views_panes.inc, line 83
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_panes_content_type($view, $display) {

  // Ensure the handler is the right type, as Views will fall back to
  // the default display if something is broken:
  if (get_class($display->handler) != 'views_content_plugin_display_panel_pane') {
    return;
  }
  $title = $display->handler
    ->get_option('pane_title');
  if (!$title) {
    $title = $view->name;
  }
  $description = $display->handler
    ->get_option('pane_description');
  if (!$description) {
    $description = $view->description;
  }
  $category = $display->handler
    ->get_option('pane_category');
  if (!$category['name']) {
    $category['name'] = t('View panes');
  }
  $icon = 'icon_views_page.png';
  $contexts = array();
  $arguments = $display->handler
    ->get_argument_input();
  foreach ($arguments as $argument) {
    if ($argument['type'] == 'context') {
      if (strpos($argument['context'], '.')) {
        list($context, $converter) = explode('.', $argument['context'], 2);
      }
      else {

        // Backwards-compat for before we had a system for delimiting the data
        // we retrieve out of context objects.
        $context = $argument['context'];
      }
      $class = 'ctools_context_' . (empty($argument['context_optional']) ? 'required' : 'optional');
      $contexts[] = new $class($argument['label'], $context);
    }
  }
  $allow = $display->handler
    ->get_option('allow');
  return array(
    'title' => $title,
    'icon' => $icon,
    'description' => filter_xss_admin($description),
    'required context' => $contexts,
    'category' => array(
      $category['name'],
      $category['weight'],
    ),
    'no title override' => empty($allow['title_override']),
  );
}