t("Node"), 'description' => t('A node object.'), 'context' => 'panels_context_create_node', 'settings form' => 'panels_context_node_settings_form', 'settings form validate' => 'panels_context_node_settings_form_validate', 'keyword' => 'node', 'context name' => 'node', ); return $args; } /** * It's important to remember that $conf is optional here, because contexts * are not always created from the UI. */ function panels_context_create_node($empty, $data = NULL, $conf = FALSE) { $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) { return $context; } if ($conf) { $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; } } if (is_array($data) || !empty($reload)) { $data = node_load($nid); } } if (!empty($data)) { $context->data = $data; $context->title = $data->title; $context->argument = $data->nid; if (is_array($context->type)) { $context->type[] = 'node-' . $data->type; } else { $context->type = array($context->type, 'node-' . $data->type); } return $context; } } function panels_context_node_settings_form($conf, $external = FALSE) { if ($external) { $form['external'] = array( '#type' => 'checkbox', '#default_value' => $conf['external'], '#title' => t('Require this context from an external source (such as a containing panel page).'), '#description' => t('If selected, node selection (below) will be ignored.'), ); } $form['node'] = array( '#prefix' => '