diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-05-14 19:27:26 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-05-14 19:27:26 +0000 |
commit | 88bfca6330cd927bc3ffe936e6dd5a27d3f8ea20 (patch) | |
tree | 80956afc828f40a16e06b6198e668efe83362ae3 /views/default | |
parent | e583b52a4d5b6d4c217c2d06f8e38fa3f8fbf5c8 (diff) | |
download | elgg-88bfca6330cd927bc3ffe936e6dd5a27d3f8ea20.tar.gz elgg-88bfca6330cd927bc3ffe936e6dd5a27d3f8ea20.tar.bz2 |
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
Diffstat (limited to 'views/default')
-rw-r--r-- | views/default/input/dropdown.php | 14 |
1 files changed, 8 insertions, 6 deletions
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 "<option $option_attrs>$option</option>"; } } 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 "<option $option_attrs>$option</option>"; + echo "<option $option_attrs>$option</option>"; + } } } ?> |