Created
May 22, 2012 17:37
-
-
Save phayes/2770495 to your computer and use it in GitHub Desktop.
Manually rendering ctools-content-type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
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