本文整理汇总了PHP中Zend\Form\ElementInterface::setDisableInArrayValidator方法的典型用法代码示例。如果您正苦于以下问题:PHP ElementInterface::setDisableInArrayValidator方法的具体用法?PHP ElementInterface::setDisableInArrayValidator怎么用?PHP ElementInterface::setDisableInArrayValidator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\ElementInterface
的用法示例。
在下文中一共展示了ElementInterface::setDisableInArrayValidator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Render.
*
* @param Select|ElementInterface $element
* @param string $groupWrapper
* @param string $controlWrapper
*
* @return string
*/
public function render(ElementInterface $element, $groupWrapper = null, $controlWrapper = null)
{
$labelHelper = $this->getLabelHelper();
$escapeHelper = $this->getEscapeHtmlHelper();
$elementHelper = $this->getElementHelper();
$elementErrorHelper = $this->getElementErrorHelper();
$descriptionHelper = $this->getDescriptionHelper();
$groupWrapper = $groupWrapper ?: $this->groupWrapper;
$controlWrapper = $controlWrapper ?: $this->controlWrapper;
/*
* Disable by default the inArrayValidator
*/
$element->setDisableInArrayValidator(true);
$elementHelper->getView();
$id = $element->getAttribute('id') ?: $element->getAttribute('name');
$element->setAttribute('class', 'form-control');
$controlLabel = '';
$label = $element->getLabel();
if (strlen($label) === 0) {
$label = $element->getOption('label') ?: $element->getAttribute('label');
}
if ($label && !$element->getOption('skipLabel')) {
$controlLabel .= $labelHelper->openTag(['class' => 'col-lg-3 ' . ($element->getOption('wrapCheckboxInLabel') ? 'checkbox' : 'control-label')] + ($element->hasAttribute('id') ? ['for' => $id] : []));
if (null !== ($translator = $labelHelper->getTranslator())) {
$label = $translator->translate($label, $labelHelper->getTranslatorTextDomain());
}
if ($element->getOption('wrapCheckboxInLabel')) {
$controlLabel .= $elementHelper->render($element) . ' ';
}
if ($element->getOption('skipLabelEscape')) {
$controlLabel .= $label;
} else {
$controlLabel .= $escapeHelper($label);
}
$controlLabel .= $labelHelper->closeTag();
}
if ($element->getOption('wrapCheckboxInLabel')) {
$controls = $controlLabel;
$controlLabel = '';
} else {
$controls = $elementHelper->render($element);
}
$controls = str_replace(['<select'], ['<select class="select-picker-contact" data-live-search="true"'], $controls);
/***
* Now apply the magic
*/
if ($element->isMultiple()) {
$controls = str_replace(['data-live-search="true"'], ['multiple data-live-search="true"'], $controls);
}
$html = $controlLabel . sprintf($controlWrapper, $id, $controls, $descriptionHelper->render($element), $elementErrorHelper->render($element));
$addtClass = $element->getMessages() ? ' has-error' : '';
return sprintf($groupWrapper, $addtClass, $id, $html);
}