diff options
author | Kjartan Mannes <kjartan@2.no-reply.drupal.org> | 2001-06-04 15:06:47 +0000 |
---|---|---|
committer | Kjartan Mannes <kjartan@2.no-reply.drupal.org> | 2001-06-04 15:06:47 +0000 |
commit | 6563382974be2a2d76b49adfaafc2600e2943c02 (patch) | |
tree | 6e50cdb8fd31ac29b63ab87464617dc2f57a1f19 | |
parent | 691d8ba54f0fb3de63548be746a6e1e98d027ced (diff) | |
download | brdo-6563382974be2a2d76b49adfaafc2600e2943c02.tar.gz brdo-6563382974be2a2d76b49adfaafc2600e2943c02.tar.bz2 |
- Changed form_select() to return NULL if called without $options. This should
not have any impact, and makes things look nicer imo.
-rw-r--r-- | includes/common.inc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/includes/common.inc b/includes/common.inc index 081c60ccb..fcb93c618 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -178,8 +178,10 @@ function form_textarea($title, $name, $value, $cols, $rows, $description = 0) { } function form_select($title, $name, $value, $options, $description = 0) { - foreach ($options as $key=>$choice) $select .= "<option value=\"$key\"". ($key == $value ? " selected" : "") .">". check_form($choice) ."</option>"; - return form_item($title, "<select name=\"edit[$name]\">$select</select>", $description); + if (count($options) > 0) { + foreach ($options as $key=>$choice) $select .= "<option value=\"$key\"". ($key == $value ? " selected" : "") .">". check_form($choice) ."</option>"; + return form_item($title, "<select name=\"edit[$name]\">$select</select>", $description); + } } function form_file($title, $name, $size, $description = 0) { |