You are here

function ctools_page_title_content_type_render in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 plugins/content_types/page/page_title.inc \ctools_page_title_content_type_render()

Output function for the 'page_title' content type.

Outputs the page title of the current page.

File

plugins/content_types/page/page_title.inc, line 31
Plugin to handle the 'page' content type which allows the standard page template variables to be embedded into a panel.

Code

function ctools_page_title_content_type_render($subtype, $conf, $panel_args) {

  // $conf['override_title'] can have one of these three values.
  // 0 i.e. hide the title, 1 i.e. no title, and 2 i.e. pane title if it's a
  // panels page.
  if (!drupal_get_title() && isset($conf['override_title']) && $conf['override_title'] === 1) {
    return;
  }

  // TODO: This should have a setting or something for the markup.
  if (empty($conf['markup'])) {
    $conf['markup'] = 'h1';
  }
  if (empty($conf['class'])) {
    $conf['class'] = '';
  }
  if (empty($conf['id'])) {
    $conf['id'] = '';
  }
  $token = ctools_set_callback_token('title', array(
    'ctools_page_title_content_type_token',
    $conf['markup'],
    $conf['id'],
    $conf['class'],
  ));
  $block = new stdClass();
  if ($token) {
    $block->content = $token;
  }
  return $block;
}