summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Boyer2008-10-05 20:45:30 (GMT)
committer Sam Boyer2008-10-05 20:45:30 (GMT)
commit86c71bb4dd7e0ea9060124c135480cefdad52701 (patch)
treea79598bf47630295ee40b39ae1556c12c11961d0
parenta0920c66e5fd0ba7a89274ed4be79418c9da9f4f (diff)
#307951 by Darren Oh: Fixed error resulting from attempts to extract keywords from empty contexts.
-rw-r--r--includes/plugins.inc16
1 files changed, 10 insertions, 6 deletions
diff --git a/includes/plugins.inc b/includes/plugins.inc
index 35ba65d..442d693 100644
--- a/includes/plugins.inc
+++ b/includes/plugins.inc
@@ -1120,9 +1120,11 @@ function panels_context_create_empty($type) {
*/
function panels_context_get_keywords($contexts) {
$keywords = array();
- foreach ($contexts as $id => $context) {
- if ($keyword = $context->get_keyword()) {
- $keywords["%$keyword"] = $context->get_title();
+ if (!empty($contexts)) {
+ foreach ($contexts as $id => $context) {
+ if ($keyword = $context->get_keyword()) {
+ $keywords["%$keyword"] = $context->get_title();
+ }
}
}
return $keywords;
@@ -1222,9 +1224,11 @@ function panels_context_match_required_contexts($required, $contexts) {
* Return the first context with a form id from a list of contexts.
*/
function panels_context_get_form($contexts) {
- foreach ($contexts as $context) {
- if (!empty($context->form_id)) {
- return $context;
+ if (!empty($contexts)) {
+ foreach ($contexts as $context) {
+ if (!empty($context->form_id)) {
+ return $context;
+ }
}
}
}