當前位置: 首頁>>代碼示例>>PHP>>正文


PHP sfWidgetFormSchema::getParent方法代碼示例

本文整理匯總了PHP中sfWidgetFormSchema::getParent方法的典型用法代碼示例。如果您正苦於以下問題:PHP sfWidgetFormSchema::getParent方法的具體用法?PHP sfWidgetFormSchema::getParent怎麽用?PHP sfWidgetFormSchema::getParent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sfWidgetFormSchema的用法示例。


在下文中一共展示了sfWidgetFormSchema::getParent方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: catch

$t->is($w->generateName('foo'), 'foo', '->generateName() returns the name unchanged if the format is false');
try {
    $w->setNameFormat('foo');
    $t->fail('->setNameFormat() throws an InvalidArgumentException if the format does not contain %s');
} catch (InvalidArgumentException $e) {
    $t->pass('->setNameFormat() throws an InvalidArgumentException if the format does not contain %s');
}
$w = new sfWidgetFormSchema(array('author' => new sfWidgetFormSchema(array('first_name' => new sfWidgetFormInputText(), 'company' => new sfWidgetFormSchema(array('name' => new sfWidgetFormInputText()))))));
$w->setNameFormat('article[%s]');
$t->is($w['author']->generateName('first_name'), 'article[author][first_name]', '->generateName() returns a HTML name attribute value for a given field name');
$t->is($w['author']['company']->generateName('name'), 'article[author][company][name]', '->generateName() returns a HTML name attribute value for a given field name');
// ->getParent() ->setParent()
$t->diag('->getParent() ->setParent()');
$author = new sfWidgetFormSchema(array('first_name' => new sfWidgetFormInputText()));
$company = new sfWidgetFormSchema(array('name' => new sfWidgetFormInputText()));
$t->is($company->getParent(), null, '->getParent() returns null if there is no parent widget schema');
$company->setParent($author);
$t->is($company->getParent(), $author, '->getParent() returns the parent widget schema');
// ->setLabels() ->setLabel() ->getLabels() ->getLabel() ->generateLabelName()
$t->diag('->setLabels() ->setLabel() ->getLabels() ->getLabel() ->generateLabelName()');
$w = new sfWidgetFormSchema(array('first_name' => new sfWidgetFormInputText()));
$w->setLabel('first_name', 'A first name');
$t->is($w->getLabels(), array('first_name' => 'A first name'), '->getLabels() returns all current labels');
$w->setLabels(array('first_name' => 'The first name'));
$t->is($w->getFormFormatter()->generateLabelName('first_name'), 'The first name', '->setLabels() changes all current labels');
$w->setLabel('first_name', 'A first name');
$t->is($w->getFormFormatter()->generateLabelName('first_name'), 'A first name', '->setLabel() sets a label value');
// ->setHelps() ->getHelps() ->setHelp() ->getHelp()
$t->diag('->setHelps() ->getHelps() ->setHelp() ->getHelp()');
$w = new sfWidgetFormSchema();
$w->setHelps(array('first_name', 'Please, provide your first name'));
開發者ID:xmasclaux,項目名稱:OpenGenepi,代碼行數:31,代碼來源:sfWidgetFormSchemaTest.php


注:本文中的sfWidgetFormSchema::getParent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。