* are not always created from the UI.
*/
function panels_context_create_node($empty, $data = NULL, $conf = FALSE) {
- $context = new panels_context('node');
+ $types = array('node');
+ if (!empty($conf['types'])) {
+ foreach ($conf['types'] as $type) {
+ if ($type) {
+ $types[] = 'node-' . $type;
+ }
+ }
+ }
+ $context = new panels_context($types);
$context->plugin = 'node';
if ($empty) {
}
if ($conf) {
- $nid = $data['nid'];
+ $nid = is_array($data) ? $data['nid'] : $data->nid;
if (module_exists('translation')) {
if ($translation = module_invoke('translation', 'node_nid', $nid, $GLOBALS['locale'])) {
$nid = $translation;
+ $reload = TRUE;
}
}
- $data = node_load($nid);
+ if (is_array($data) || !empty($reload)) {
+ $data = node_load($nid);
+ }
}
if (!empty($data)) {