本文整理汇总了PHP中Zend\Form\Fieldset::prepareElement方法的典型用法代码示例。如果您正苦于以下问题:PHP Fieldset::prepareElement方法的具体用法?PHP Fieldset::prepareElement怎么用?PHP Fieldset::prepareElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\Fieldset
的用法示例。
在下文中一共展示了Fieldset::prepareElement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareElement
/**
* Prepare the collection by adding a dummy template element if the user want one
*
* @param FormInterface $form
* @return mixed|void
*/
public function prepareElement(FormInterface $form)
{
if (true === $this->shouldCreateChildrenOnPrepareElement) {
if ($this->targetElement !== null && $this->count > 0) {
while ($this->count > $this->lastChildIndex + 1) {
$this->addNewTargetElementInstance(++$this->lastChildIndex);
}
}
}
// Create a template that will also be prepared
if ($this->shouldCreateTemplate) {
$templateElement = $this->getTemplateElement();
$this->add($templateElement);
}
parent::prepareElement($form);
// The template element has been prepared, but we don't want it to be rendered nor validated, so remove it from the list
if ($this->shouldCreateTemplate) {
$this->remove($this->templatePlaceholder);
}
}
示例2: prepareElement
/**
* Prepare the collection by adding a dummy template element if the user want one
*
* @param FormInterface $form
* @return mixed|void
*/
public function prepareElement(FormInterface $form)
{
// Create a template that will also be prepared
if ($this->shouldCreateTemplate) {
$templateElement = $this->getTemplateElement();
$this->add($templateElement);
}
parent::prepareElement($form);
// The template element has been prepared, but we don't want it to be rendered nor validated, so remove it from the list
if ($this->shouldCreateTemplate) {
$this->remove($this->templatePlaceholder);
}
}
示例3: prepareElement
/**
* Prepare the collection by adding a dummy template element if the user want one
*
* @param FormInterface $form
* @return mixed|void
*/
public function prepareElement(FormInterface $form)
{
if (true === $this->shouldCreateChildrenOnPrepareElement) {
if ($this->targetElement !== null && $this->count > 0) {
$applyNames = count($this->keyNames) > 0 && count($this->keyNames) === $this->count ? 1 : 0;
while ($this->count > $this->lastChildIndex + 1) {
$label = isset($this->labels[$this->lastChildIndex + 1]) ? $this->labels[$this->lastChildIndex + 1] : null;
$this->addNewTargetElementInstance($applyNames ? $this->keyNames[++$this->lastChildIndex] : ++$this->lastChildIndex, $label);
}
}
}
// Create a template that will also be prepared
if ($this->shouldCreateTemplate) {
$templateElement = $this->getTemplateElement();
$this->add($templateElement);
}
parent::prepareElement($form);
// The template element has been prepared, but we don't want it to be
// rendered nor validated, so remove it from the list.
if ($this->shouldCreateTemplate) {
$this->remove($this->templatePlaceholder);
}
}