Changeset 13060
- Timestamp:
- 11/17/08 12:52:11 (1 year ago)
- Files:
-
- branches/1.2/lib/form/sfForm.class.php (modified) (1 diff)
- branches/1.2/lib/generator/sfAdminGenerator.class.php (modified) (1 diff)
- branches/1.2/lib/generator/sfModelGenerator.class.php (modified) (1 diff)
- branches/1.2/test/unit/form/sfFormTest.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.2/lib/form/sfForm.class.php
r12766 r13060 329 329 330 330 /** 331 * Returns the array name under which user data can retrieved. 332 * 333 * If the user data is not stored under an array, it returns null. 334 * 335 * @return string The name 336 */ 337 public function getName() 338 { 339 if ('%s' == $nameFormat = $this->widgetSchema->getNameFormat()) 340 { 341 return false; 342 } 343 344 return str_replace('[%s]', '', $nameFormat); 345 } 346 347 /** 331 348 * Gets the error schema associated with the form. 332 349 * branches/1.2/lib/generator/sfAdminGenerator.class.php
r11349 r13060 739 739 } 740 740 741 public function getFormParameterName()742 {743 return str_replace('[%s]', '', $this->getFormObject()->getWidgetSchema()->getNameFormat());744 }745 746 741 /** 747 742 * Retrieves all hidden fields in the widget schema branches/1.2/lib/generator/sfModelGenerator.class.php
r12546 r13060 322 322 323 323 /** 324 * Gets the form parameter name.325 *326 * @param string The form parameter name327 */328 public function getFormParameterName()329 {330 return str_replace('[%s]', '', $this->getFormObject()->getWidgetSchema()->getNameFormat());331 }332 333 /**334 324 * Gets the HTML to add to the form tag if the form is multipart. 335 325 * branches/1.2/test/unit/form/sfFormTest.php
r12766 r13060 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(1 29, new lime_output_color());13 $t = new lime_test(131, new lime_output_color()); 14 14 15 15 class FormTest extends sfForm … … 70 70 $t->is($f->getDefault('_csrf_token'), $f->getCSRFToken('*mygreatsecret*'), '->getDefaults() keeps the CSRF token default value'); 71 71 sfForm::disableCSRFProtection(); 72 73 // ->getName() 74 $t->diag('->getName()'); 75 $f = new FormTest(); 76 $w = new sfWidgetFormSchema(); 77 $f->setWidgetSchema($w); 78 $t->is($f->getName(), null, '->getName() returns null if the name format is not an array'); 79 $w->setNameFormat('foo[%s]'); 80 $t->is($f->getName(), 'foo', '->getName() returns the name under which user data can be retrieved'); 72 81 73 82 // ::enableCSRFProtection() ::disableCSRFProtection() ->isCSRFProtected()

