Skip to content

Instantly share code, notes, and snippets.

@amanaplan
Forked from phayes/gist:2770495
Created October 4, 2017 13:26
Show Gist options
  • Save amanaplan/d9136200b10736e01f8238f4fa44f9f1 to your computer and use it in GitHub Desktop.
Save amanaplan/d9136200b10736e01f8238f4fa44f9f1 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