本文整理匯總了PHP中Zend\Form\ElementInterface::allowAdd方法的典型用法代碼示例。如果您正苦於以下問題:PHP ElementInterface::allowAdd方法的具體用法?PHP ElementInterface::allowAdd怎麽用?PHP ElementInterface::allowAdd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\Form\ElementInterface
的用法示例。
在下文中一共展示了ElementInterface::allowAdd方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getControl
/**
* @param ElementInterface $element
* @return string
*/
protected function getControl(ElementInterface $element)
{
$btnHelper = $this->getView()->plugin('btn');
$iconHelper = $this->getView()->plugin('icon');
if ($element instanceof Collection && $element->allowAdd() && $element->shouldCreateTemplate()) {
return $btnHelper($iconHelper('plus'), ['class' => 'btn-success pull-right clearfix', 'onclick' => "return CmsCommon.Form.Collection.addFieldset(this, 'prepend');"]);
} elseif ($element instanceof FieldsetInterface && !$element instanceof Collection && $element->getOption('allow_remove')) {
return $btnHelper($iconHelper('minus'), ['class' => 'btn-danger pull-right clearfix', 'onclick' => 'return CmsCommon.Form.Collection.removeFieldset(this);']);
}
}
示例2: needsButtons
/**
* Determines whether this element needs the add/remove buttons at all.
* @param ElementInterface $element
* @return boolean
*/
protected function needsButtons(ElementInterface $element)
{
if (!$element instanceof Collection) {
return false;
}
return $element->allowAdd() || $element->allowRemove();
}
示例3: getControl
/**
* @param ElementInterface $element
* @return string
*/
protected function getControl(ElementInterface $element)
{
$control = '';
if ($element instanceof Collection && $element->allowAdd() && $element->shouldCreateTemplate()) {
$control = ' <button type="button" class="btn btn-add-fieldset" ' . 'onclick="return CmsCommon.Form.Collection.addFieldset(this, \'prepend\');">' . '+</button>';
} elseif ($element instanceof FieldsetInterface && !$element instanceof Collection && $element->getOption('allow_remove')) {
$control = ' <button type="button" class="btn btn-remove-fieldset" ' . 'onclick="return CmsCommon.Form.Collection.removeFieldset(this);">' . '-</button>';
}
return $control;
}