You are here

function ctools_content_admin_title in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 includes/content.inc \ctools_content_admin_title()

Get the administrative title from a given content type.

Parameters

$type: The content type. May be the name or an already loaded content type object.

$subtype: The subtype being rendered.

$conf: The configuration for the content type.

$context: An array of context objects available for use. These may be placeholders.

File

includes/content.inc, line 385
Contains the tools to handle pluggable content that can be used by other applications such as Panels or Dashboard.

Code

function ctools_content_admin_title($type, $subtype, $conf, $context = NULL) {
  if (is_array($type)) {
    $plugin = $type;
  }
  elseif (is_string($type)) {
    $plugin = ctools_get_content_type($type);
  }
  else {
    return;
  }
  if ($function = ctools_plugin_get_function($plugin, 'admin title')) {
    $pane_context = ctools_content_select_context($plugin, $subtype, $conf, $context);
    if ($pane_context === FALSE) {
      if ($plugin['name'] == $subtype) {
        return t('@type will not display due to missing context', array(
          '@type' => $plugin['name'],
        ));
      }
      return t('@type:@subtype will not display due to missing context', array(
        '@type' => $plugin['name'],
        '@subtype' => $subtype,
      ));
    }
    return $function($subtype, $conf, $pane_context);
  }
  elseif (isset($plugin['admin title'])) {
    return $plugin['admin title'];
  }
  elseif (isset($plugin['title'])) {
    return $plugin['title'];
  }
}