]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
fixes a php warning if no options are passed to input/dropdown view
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 14 May 2011 19:27:26 +0000 (19:27 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 14 May 2011 19:27:26 +0000 (19:27 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@9078 36083f99-b078-4883-b0ff-0f9b5a30f544

views/default/input/dropdown.php

index 6fd97d3b5d4b86800041c2ab268a808498fb215b..fccccb8888ce3da768580840e9d5e9974a16b373 100644 (file)
@@ -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>";
+               }
        }
 }
 ?>