From 88bfca6330cd927bc3ffe936e6dd5a27d3f8ea20 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 14 May 2011 19:27:26 +0000 Subject: fixes a php warning if no options are passed to input/dropdown view git-svn-id: http://code.elgg.org/elgg/trunk@9078 36083f99-b078-4883-b0ff-0f9b5a30f544 --- views/default/input/dropdown.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'views') diff --git a/views/default/input/dropdown.php b/views/default/input/dropdown.php index 6fd97d3b5..fccccb888 100644 --- a/views/default/input/dropdown.php +++ b/views/default/input/dropdown.php @@ -3,7 +3,7 @@ * Elgg dropdown input * Displays a dropdown (select) input field * - * NB: Default values of FALSE or NULL will match '' (empty string) and not 0. + * @warning Default values of FALSE or NULL will match '' (empty string) and not 0. * * @package Elgg * @subpackage Core @@ -47,13 +47,15 @@ if ($options_values) { echo ""; } } else { - foreach ($options as $option) { + if (is_array($options)) { + foreach ($options as $option) { - $option_attrs = elgg_format_attributes(array( - 'selected' => (string)$option == (string)$value - )); + $option_attrs = elgg_format_attributes(array( + 'selected' => (string)$option == (string)$value + )); - echo ""; + echo ""; + } } } ?> -- cgit v1.2.3