Changeset 8284
- Timestamp:
- 04/04/08 14:57:26 (5 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/widget/sfWidgetFormSchema.class.php
r8021 r8284 132 132 $name = $this->getFormFormatterName(); 133 133 134 if (isset($this->formFormatters[$name])) 135 { 136 return $this->formFormatters[$name]; 137 } 138 139 $class = 'sfWidgetFormSchemaFormatter'.ucfirst($name); 140 if (class_exists($class)) 141 { 142 return new $class(); 143 } 144 145 throw new InvalidArgumentException(sprintf('The form formatter "%s" does not exist.', $name)); 134 if (!isset($this->formFormatters[$name])) 135 { 136 $class = 'sfWidgetFormSchemaFormatter'.ucfirst($name); 137 138 if (!class_exists($class)) 139 { 140 throw new InvalidArgumentException(sprintf('The form formatter "%s" does not exist.', $name)); 141 } 142 143 $this->formFormatters[$name] = new $class(); 144 } 145 146 return $this->formFormatters[$name]; 146 147 } 147 148 … … 302 303 * 303 304 * @param string The name of the HTML widget 304 * @param mixed The value of the widget305 * @param mixed The values of the widget 305 306 * @param array An array of HTML attributes 306 307 * @param array An array of errors branches/1.1/test/unit/widget/sfWidgetFormSchemaTest.php
r8021 r8284 93 93 } 94 94 95 $t->is($w->getFormFormatters(), array('custom' => $customFormatter), '->getFormFormatters() returns an array of all formatter for this widget schema'); 95 $formatterNames = array_keys($w->getFormFormatters()); 96 sort($formatterNames); 97 $t->is($formatterNames, array('custom', 'list', 'table'), '->getFormFormatters() returns an array of all formatter for this widget schema'); 96 98 97 99 // ->setNameFormat() ->getNameFormat() ->generateName()