summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Boyer2008-07-29 09:37:24 (GMT)
committer Sam Boyer2008-07-29 09:37:24 (GMT)
commita2864642778a98f9b07e2f147101df57b97d0ce6 (patch)
tree5e20d81bc8d81c5486b75441e144b1fc18c53bfc
parent00c75fc6caad550cbec5c3cedcc7af2a137a8130 (diff)
#258383 by gordon: Expands context to allow for more granular information about contextual data during various stages of the editing process (e.g.: not just that there's a node context, but what node TYPES are available in that context).
-rw-r--r--arguments/nid.inc4
-rw-r--r--contexts/node.inc10
-rw-r--r--includes/plugins.inc7
3 files changed, 14 insertions, 7 deletions
diff --git a/arguments/nid.inc b/arguments/nid.inc
index db9522b..7e3b85a 100644
--- a/arguments/nid.inc
+++ b/arguments/nid.inc
@@ -28,7 +28,7 @@ function panels_nid_panels_arguments() {
function panels_nid_context($arg = NULL, $conf = NULL, $empty = FALSE) {
// If unset it wants a generic, unfilled context.
if ($empty) {
- return panels_context_create_empty('node');
+ return panels_context_create_empty('node', $conf);
}
if (!is_numeric($arg)) {
@@ -44,7 +44,7 @@ function panels_nid_context($arg = NULL, $conf = NULL, $empty = FALSE) {
return FALSE;
}
- return panels_context_create('node', $node);
+ return panels_context_create('node', $node, $conf);
}
/**
diff --git a/contexts/node.inc b/contexts/node.inc
index be48b17..eca7f6a 100644
--- a/contexts/node.inc
+++ b/contexts/node.inc
@@ -26,7 +26,15 @@ function panels_node_panels_contexts() {
* 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) {
diff --git a/includes/plugins.inc b/includes/plugins.inc
index ca191db..6def5b7 100644
--- a/includes/plugins.inc
+++ b/includes/plugins.inc
@@ -1092,9 +1092,9 @@ function panels_context_create($type, $data = NULL, $conf = FALSE) {
}
}
-function panels_context_create_empty($type) {
+function panels_context_create_empty($type, $conf = FALSE) {
if ($function = panels_plugin_get_function('contexts', $type, 'context')) {
- return $function(TRUE);
+ return $function(TRUE, NULL, $conf);
}
}
@@ -1387,8 +1387,7 @@ function panels_panels_include_directory($plugin_type) {
/**
* Load plugin info for all hooks; this is handled separately from plugins
- * from files. This is cached so we don't find ourselves building htis
- * repeatedly.
+ * from files. This caches so we don't find ourselves building it repeatedly.
*
* NOTE: This hook does work, but if you are implementing Panels in a client,
* @see panels_get_include_directories() as it is the preferred method.