From 14a53b1d80b930f9548e34531f2e5dbac7ef3b50 Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel
Date: Mon, 6 Apr 2009 11:45:52 +0200 Subject: [PATCH] Fix setting of attributes. --- koward/lib/Form/Object.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/koward/lib/Form/Object.php b/koward/lib/Form/Object.php index e4ba07ac7..abbf26bf9 100644 --- a/koward/lib/Form/Object.php +++ b/koward/lib/Form/Object.php @@ -81,7 +81,7 @@ class Koward_Form_Object extends Horde_Form { */ function _getFields($config) { - if (isset($config['attributes']['fields']) && !empty($config['attribute']['override'])) { + if (isset($config['attributes']['fields']) && !empty($config['attributes']['override'])) { return $config['attributes']['fields']; } else { list($attributes, $attribute_map) = $this->koward->server->getAttributes($config['class']); @@ -95,21 +95,19 @@ class Koward_Form_Object extends Horde_Form { } } + $form_attributes = array(); + foreach ($akeys as $key) { if (isset($config['attributes']['hide']) && in_array($key, $config['attributes']['hide'])) { continue; } - if (isset($config['attributes']['fields'][$key])) { - $form_attributes[$key] = $config['attributes']['fields'][$key]; - } else { - $form_attributes[$key] = array( - 'type' => 'text', - 'required' => in_array($key, $attribute_map['required']), - 'readonly' => in_array($key, $attribute_map['locked']), - 'params' => array('regex' => '', 'size' => 40, 'maxlength' => 255) - ); - } + $form_attributes[$key] = array( + 'type' => 'text', + 'required' => in_array($key, $attribute_map['required']), + 'readonly' => in_array($key, $attribute_map['locked']), + 'params' => array('regex' => '', 'size' => 40, 'maxlength' => 255) + ); if (isset($config['attributes']['order'][$key])) { $form_attributes[$key]['order'] = $config['attributes']['order'][$key]; } else { @@ -122,6 +120,10 @@ class Koward_Form_Object extends Horde_Form { } else { $form_attributes[$key]['label'] = $key; } + if (isset($config['attributes']['fields'][$key])) { + $form_attributes[$key] = array_merge($form_attributes[$key], + $config['attributes']['fields'][$key]); + } } uasort($form_attributes, array($this, '_sortFields')); return $form_attributes; -- 2.11.0