本文整理汇总了PHP中ContactForm::addField方法的典型用法代码示例。如果您正苦于以下问题:PHP ContactForm::addField方法的具体用法?PHP ContactForm::addField怎么用?PHP ContactForm::addField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContactForm
的用法示例。
在下文中一共展示了ContactForm::addField方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* Initializes the honey pot. Loads CSS, and adds the field
*
* @param ContactForm
* @return HoneyPotSpamProtector
*/
public function initialize(ContactForm $proxy)
{
Requirements::customCSS("\n\t\t\t#{$this->name} {position:absolute;left:-9999em;}\n\t\t");
$proxy->addField(TextField::create($this->name, null)->setAttribute('tabindex', '-1'));
$proxy->addOmittedField($this->name);
return $this;
}
示例2: initialize
/**
* Sets up the spam question. Chooses a question at random and adds it to the form
*
* @param ContactForm
*/
public function initialize(ContactForm $proxy)
{
if (sizeof($this->questions)) {
$rand = rand(0, sizeof($this->questions) - 1);
$q = $this->questions[$rand];
$name = "SimpleQuestion_{$rand}";
$proxy->addField(LabelField::create("SimpleSpamQuestion_label_{$rand}", $this->heading))->addField(TextField::create($name, $q['question']));
$proxy->addOmittedField($name);
}
}