本文整理匯總了PHP中sfWidgetFormSchema::getFormFormatter方法的典型用法代碼示例。如果您正苦於以下問題:PHP sfWidgetFormSchema::getFormFormatter方法的具體用法?PHP sfWidgetFormSchema::getFormFormatter怎麽用?PHP sfWidgetFormSchema::getFormFormatter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sfWidgetFormSchema
的用法示例。
在下文中一共展示了sfWidgetFormSchema::getFormFormatter方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: configure
$f1 = $w1->getFormFormatters();
$f = $w->getFormFormatters();
$t->is(array_keys($f1), array_keys($f), '__clone() clones form formatters');
foreach ($f1 as $key => $formFormatter) {
$t->ok($formFormatter !== $f[$key], '__clone() clones form formatters');
$t->is(get_class($formFormatter), get_class($f[$key]), '__clone() clones form formatters');
$t->ok($formFormatter->getWidgetSchema() !== $f[$key]->getWidgetSchema(), '__clone() clones form formatters');
$t->is(get_class($formFormatter->getWidgetSchema()), get_class($f[$key]->getWidgetSchema()), '__clone() clones form formatters');
}
// setDefaultFormFormatterName()
$t->diag('setDefaultFormFormatterName()');
$w = new sfWidgetFormSchema(array('w1' => $w1, 'w2' => $w2));
$t->isa_ok($w->getFormFormatter(), 'sfWidgetFormSchemaFormatterTable', 'setDefaultFormFormatterName() has the "sfWidgetFormSchemaFormatterTable" form formatter by default');
sfWidgetFormSchema::setDefaultFormFormatterName('list');
$w = new sfWidgetFormSchema(array('w1' => $w1, 'w2' => $w2));
$t->isa_ok($w->getFormFormatter(), 'sfWidgetFormSchemaFormatterList', 'setDefaultFormFormatterName() changes the default form formatter name correctly');
class MyWidget extends sfWidgetForm
{
protected function configure($options = array(), $attributes = array())
{
$this->addRequiredOption('name');
}
public function render($name, $value = null, $attributes = array(), $errors = array())
{
return null;
}
public function getJavaScripts()
{
return array('/path/to/a/' . $this->getOption('name') . '.js', '/path/to/foo.js');
}
public function getStylesheets()