aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
Diffstat (limited to 'views')
-rw-r--r--views/default/input/access.php41
1 files changed, 8 insertions, 33 deletions
diff --git a/views/default/input/access.php b/views/default/input/access.php
index 79807cedd..ea4654be6 100644
--- a/views/default/input/access.php
+++ b/views/default/input/access.php
@@ -14,40 +14,15 @@
*
*/
-$class = "elgg-input-access";
-if (isset($vars['class'])) {
- $class = $vars['class'];
-}
+$defaults = array(
+ 'class' => 'elgg-input-access',
+ 'disabled' => FALSE,
+ 'value' => get_default_access(),
+ 'options' => get_write_access_array(),
+);
-$disabled = false;
-if (isset($vars['disabled'])) {
- $disabled = $vars['disabled'];
-}
-
-if (!array_key_exists('value', $vars) || $vars['value'] == ACCESS_DEFAULT) {
- $vars['value'] = get_default_access();
-}
-
-if ((!isset($vars['options'])) || (!is_array($vars['options']))) {
- $vars['options'] = array();
- $vars['options'] = get_write_access_array();
-}
+$vars = array_merge($defaults, $vars);
if (is_array($vars['options']) && sizeof($vars['options']) > 0) {
- ?>
-
- <select <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['js'])) echo $vars['js']; ?> <?php if ($disabled) echo ' disabled="yes" '; ?> class="<?php echo $class; ?>">
- <?php
-
- foreach($vars['options'] as $key => $option) {
- if ($key != $vars['value']) {
- echo "<option value=\"{$key}\">". htmlentities($option, ENT_QUOTES, 'UTF-8') ."</option>";
- } else {
- echo "<option value=\"{$key}\" selected=\"selected\">". htmlentities($option, ENT_QUOTES, 'UTF-8') ."</option>";
- }
- }
-
- ?>
- </select>
- <?php
+ echo elgg_view('input/dropdown', $vars);
} \ No newline at end of file