本文整理匯總了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);
}
}