本文整理汇总了PHP中Zend\Form\ElementInterface::getRendererHelperName方法的典型用法代码示例。如果您正苦于以下问题:PHP ElementInterface::getRendererHelperName方法的具体用法?PHP ElementInterface::getRendererHelperName怎么用?PHP ElementInterface::getRendererHelperName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\ElementInterface
的用法示例。
在下文中一共展示了ElementInterface::getRendererHelperName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderElement
/**
* Render an element
*
* Introspects the element type and attributes to determine which
* helper to utilize when rendering.
*
* @param \Zend\Form\ElementInterface $element
* @return string
*/
public function renderElement(ElementInterface $element)
{
if (!method_exists($this->view, 'plugin')) {
// Bail early if renderer is not pluggable
return '';
}
if ($element instanceof HelperAwareInterface && ($plugin = $element->getRendererHelperName())) {
$plugin = $this->tryLoadPlugin($plugin);
}
if (empty($plugin)) {
$class = explode('\\', get_class($element));
$plugin = $this->tryLoadPlugin('form_' . end($class));
}
if (empty($plugin)) {
$plugin = $this->tryLoadPlugin('form_' . $element->getAttribute('type'));
}
if (empty($plugin)) {
$plugin = $this->tryLoadPlugin('form_input');
}
$enabled = $this->isTranslatorEnabled();
$textDomain = $this->getTranslatorTextDomain();
if ($element instanceof TranslatorSettingsAwareInterface) {
$enabled = $element->isTranslatorEnabled();
if (null !== $element->getTranslatorTextDomain()) {
$textDomain = $element->getTranslatorTextDomain();
}
}
if (method_exists($plugin, 'setTranslatorEnabled')) {
$plugin->setTranslatorEnabled($enabled);
}
if ($enabled) {
if (method_exists($plugin, 'setTranslatorTextDomain')) {
$plugin->setTranslatorTextDomain($textDomain);
}
}
return $plugin($element);
}