function ctools_content_render

cis7 content.inc ctools_content_render($type, $subtype, $conf, $keywords = array(), $args = array(), $context = array(), $incoming_content = '')
cle7 content.inc ctools_content_render($type, $subtype, $conf, $keywords = array(), $args = array(), $context = array(), $incoming_content = '')
elmsmedia7 content.inc ctools_content_render($type, $subtype, $conf, $keywords = array(), $args = array(), $context = array(), $incoming_content = '')
icor7 content.inc ctools_content_render($type, $subtype, $conf, $keywords = array(), $args = array(), $context = array(), $incoming_content = '')
meedjum_blog7 content.inc ctools_content_render($type, $subtype, $conf, $keywords = array(), $args = array(), $context = array(), $incoming_content = '')
mooc7 content.inc ctools_content_render($type, $subtype, $conf, $keywords = array(), $args = array(), $context = array(), $incoming_content = '')

Get the content from a given content type.

Parameters

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

$subtype: The name of the subtype being rendered.

$conf: The configuration for the content type.

$keywords: An array of replacement keywords that come from outside contexts.

$args: The arguments provided to the owner of the content type. Some content may wish to configure itself based on the arguments the panel or dashboard received.

$context: An array of context objects available for use.

$incoming_content: Any incoming content, if this display is a wrapper.

Return value

The content as rendered by the plugin. This content should be an array with the following possible keys:

  • title: The safe to render title of the content.
  • content: The safe to render HTML content.
  • links: An array of links associated with the content suitable for theme('links').
  • more: An optional 'more' link (destination only)
  • admin_links: Administrative links associated with the content, suitable for theme('links').
  • feeds: An array of feed icons or links associated with the content. Each member of the array is rendered HTML.
  • type: The content type.
  • subtype: The content subtype. These two may be used together as module-delta for block style rendering.
2 calls to ctools_content_render()
ctools_ajax_simple_form in sites/all/modules/ulmus/ctools/ctools_ajax_sample/ctools_ajax_sample.module
ds_render_ctools_field in sites/all/modules/ulmus/ds/ds.module
Render a CTools field.

File

sites/all/modules/ulmus/ctools/includes/content.inc, line 259
Contains the tools to handle pluggable content that can be used by other applications such as Panels or Dashboard.

Code

function ctools_content_render($type, $subtype, $conf, $keywords = array(), $args = array(), $context = array(), $incoming_content = '') {
  if (is_array($type)) {
    $plugin = $type;
  }
  else {
    $plugin = ctools_get_content_type($type);
  }

  $subtype_info = ctools_content_get_subtype($plugin, $subtype);

  $function = ctools_plugin_get_function($subtype_info, 'render callback');
  if (!$function) {
    $function = ctools_plugin_get_function($plugin, 'render callback');
  }

  if ($function) {
    $pane_context = ctools_content_select_context($plugin, $subtype, $conf, $context);
    if ($pane_context === FALSE) {
      return;
    }

    $content = $function($subtype, $conf, $args, $pane_context, $incoming_content);

    if (empty($content)) {
      return;
    }

    // Set up some defaults and other massaging on the content before we hand
    // it back to the caller.
    if (!isset($content->type)) {
      $content->type = $plugin['name'];
    }

    if (!isset($content->subtype)) {
      $content->subtype = $subtype;
    }

    // Override the title if configured to
    if (!empty($conf['override_title'])) {
      // Give previous title as an available substitution here.
      $keywords['%title'] = empty($content->title) ? '' : $content->title;
      $content->original_title = $keywords['%title'];
      $content->title = $conf['override_title_text'];
    }

    if (!empty($content->title)) {
      // Perform substitutions
      if (!empty($keywords) || !empty($context)) {
        $content->title = ctools_context_keyword_substitute($content->title, $keywords, $context);
      }

      // Sterilize the title
      $content->title = filter_xss_admin($content->title);

      // If a link is specified, populate.
      if (!empty($content->title_link)) {
        if (!is_array($content->title_link)) {
          $url = array('href' => $content->title_link);
        }
        else {
          $url = $content->title_link;
        }
        // set defaults so we don't bring up notices
        $url += array(
          'href' => '',
          'attributes' => array(),
          'query' => array(),
          'fragment' => '',
          'absolute' => NULL,
          'html' => TRUE,
        );
        $content->title = l($content->title, $url['href'], $url);
      }
    }

    return $content;
  }
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.