Skip to content

Instantly share code, notes, and snippets.

@phayes
Created May 22, 2012 17:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save phayes/2770495 to your computer and use it in GitHub Desktop.
Save phayes/2770495 to your computer and use it in GitHub Desktop.
Manually rendering ctools-content-type
<?
ctools_include('plugins');
ctools_include('context');
ctools_include('content');
$plugin_id = 'super_pane';
$plugin = ctools_get_plugins('ctools','content_types', $this->options['field'], $plugin_id);
$conf = array() // array of configuration to pass to the content-type
$entity = node_load(1) // Create a context, if required
$context_id = 'node'; // As defined by the content-type plugun
if ($entity) {
$entity_context = ctools_context_create($context_id, $entity);
$entity_context->identifier = t('This @id', array('@id' => $context_id));
$entity_context->keyword = $context_id;
$context = array($context_id => $entity_context);
$conf['context'] = $context_id;
$ctools_content = ctools_content_render($plugin_id, $plugin_id, $conf, array(), array(), $context);
}
else {
$context = array();
$ctools_content = ctools_content_render($plugin_id, $plugin_id, $conf);
}
return $ctools_content->content;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment