Created
September 16, 2015 14:15
-
-
Save matglas/290a4f683e38ecf708f2 to your computer and use it in GitHub Desktop.
Loading a panel with context programaticly
This file contains hidden or 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
<?php | |
ctools_include('context'); | |
ctools_include('content'); | |
// Load ctools context from the arguments. | |
$context = array(); | |
$context_arguments = array( | |
'identifier' => 'node', // Required: Identifier to the panel. | |
'name' => 'entity_id:node', // Required: Identifier used by argument plugins. | |
'title' => 'Node', // Optional. | |
'keyword' => 'node', // Required: Purpose? | |
'id' => '1' // Required: Needed for uniqueness. | |
); | |
$nid = $node->get('nid')->value(); | |
$context = ctools_context_get_context_from_argument($context_arguments, $nid); | |
// Load the panel pane. | |
$type = 'slider'; | |
$subtype = 'slider'; | |
$conf = NULL; | |
$contexts = array('node' => $context); | |
$keywords = array(); | |
$args = array(); | |
$data = ctools_content_render($type, $subtype, $conf, $keywords, $args, $contexts); | |
print $data->content; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment