本文整理汇总了PHP中sfWidgetFormSchema::getFormFormatterName方法的典型用法代码示例。如果您正苦于以下问题:PHP sfWidgetFormSchema::getFormFormatterName方法的具体用法?PHP sfWidgetFormSchema::getFormFormatterName怎么用?PHP sfWidgetFormSchema::getFormFormatterName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfWidgetFormSchema
的用法示例。
在下文中一共展示了sfWidgetFormSchema::getFormFormatterName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sfWidgetFormSchema
$t->diag('__construct()');
$w = new sfWidgetFormSchema();
$t->is($w->getFields(), array(), '__construct() can take no argument');
$w = new sfWidgetFormSchema(array('w1' => $w1, 'w2' => $w2));
$w1->setParent($w);
$w2->setParent($w);
$t->ok($w->getFields() == array('w1' => $w1, 'w2' => $w2), '__construct() can take an array of named sfWidget objects');
try {
$w = new sfWidgetFormSchema('string');
$t->fail('__construct() throws a exception when passing a non supported first argument');
} catch (InvalidArgumentException $e) {
$t->pass('__construct() throws an exception when passing a non supported first argument');
}
$t->is($w->getFormFormatterName(), 'table', '__construct() sets "form_formatter" option to "table" by default');
$w = new sfWidgetFormSchema(array(), array('form_formatter' => 'list'));
$t->is($w->getFormFormatterName(), 'list', '__construct() can override the default value for the "form_formatter" option');
$t->is($w->getNameFormat(), '%s', '__construct() sets "name_format" option to "table" by default');
$w = new sfWidgetFormSchema(array(), array('name_format' => 'name_%s'));
$t->is($w->getNameFormat(), 'name_%s', '__construct() can override the default value for the "name_format" option');
// implements ArrayAccess
$t->diag('implements ArrayAccess');
$w = new sfWidgetFormSchema();
$w['w1'] = $w1;
$w['w2'] = $w2;
$w1->setParent($w);
$w2->setParent($w);
$t->ok($w->getFields() == array('w1' => $w1, 'w2' => $w2), 'sfWidgetFormSchema implements the ArrayAccess interface for the fields');
$t->is($w1->getParent(), $w, 'The widget schema is associated with the fields');
$t->is($w2->getParent(), $w, 'The widget schema is associated with the fields');
try {
$w['w1'] = 'string';