当前位置: 首页>>代码示例>>PHP>>正文


PHP sfWidgetFormSchema::getFields方法代码示例

本文整理汇总了PHP中sfWidgetFormSchema::getFields方法的典型用法代码示例。如果您正苦于以下问题:PHP sfWidgetFormSchema::getFields方法的具体用法?PHP sfWidgetFormSchema::getFields怎么用?PHP sfWidgetFormSchema::getFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfWidgetFormSchema的用法示例。


在下文中一共展示了sfWidgetFormSchema::getFields方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: dirname

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';
$t = new lime_test(94);
$w1 = new sfWidgetFormInputText(array(), array('class' => 'foo1'));
$w2 = new sfWidgetFormInputText();
// __construct()
$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'));
开发者ID:xmasclaux,项目名称:OpenGenepi,代码行数:30,代码来源:sfWidgetFormSchemaTest.php

示例2: sfWidgetFormSchema

    </table>
    <input type="hidden" name="w1" id="w1" />
  </td>
</tr>

EOF;
$t->is(str_replace("\n", '', preg_replace('/^ +/m', '', $w->render(null))), str_replace("\n", '', preg_replace('/^ +/m', '', $expected)), '->render() is able to render widget schema that only contains hidden fields when the last field is a form');
// __clone()
$t->diag('__clone()');
$w = new sfWidgetFormSchema(array('w1' => $w1, 'w2' => $w2));
$format1 = new sfWidgetFormSchemaFormatterList($w);
$format1->setTranslationCatalogue('english');
$w->addFormFormatter('testFormatter', $format1);
$w1 = clone $w;
$f1 = $w1->getFields();
$f = $w->getFields();
$t->is(array_keys($f1), array_keys($f), '__clone() clones embedded widgets');
foreach ($f1 as $name => $widget) {
    $t->ok($widget !== $f[$name], '__clone() clones embedded widgets');
    $t->ok($widget == $f[$name], '__clone() clones embedded widgets');
}
$format1->setTranslationCatalogue('french');
$formatters = $w1->getFormFormatters();
$t->is(count($formatters), 1, '__clone() returns a sfWidgetFormSchema that has the Formatters attached');
$t->is($formatters['testFormatter']->getTranslationCatalogue(), 'english', '__clone() clones formatters, so that changes to the original one have no effect to the cloned formatter.');
$w = new sfWidgetFormSchema();
$w->addFormFormatter('table', new sfWidgetFormSchemaFormatterTable($w));
$w->addFormFormatter('list', new sfWidgetFormSchemaFormatterList($w));
$w1 = clone $w;
$f1 = $w1->getFormFormatters();
$f = $w->getFormFormatters();
开发者ID:WIZARDISHUNGRY,项目名称:symfony,代码行数:31,代码来源:sfWidgetFormSchemaTest.php


注:本文中的sfWidgetFormSchema::getFields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。