本文整理汇总了PHP中Zend\Form\Element::setView方法的典型用法代码示例。如果您正苦于以下问题:PHP Element::setView方法的具体用法?PHP Element::setView怎么用?PHP Element::setView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\Element
的用法示例。
在下文中一共展示了Element::setView方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setView
/**
* Set the view object
*
* Ensures that the view object has the dojo view helper path set.
*
* @param \Zend\View\ViewEngine $view
* @return \Zend\Dojo\Form\Element\Dijit
*/
public function setView(View $view = null)
{
if (null !== $view) {
if (false === $view->getPluginLoader('helper')->getPaths('Zend\\Dojo\\View\\Helper')) {
$view->addHelperPath('Zend/Dojo/View/Helper', 'Zend\\Dojo\\View\\Helper');
}
}
return parent::setView($view);
}
示例2: testRetrievingLabelRetrievesLabelWithTranslationAndPrefixAndSuffix
public function testRetrievingLabelRetrievesLabelWithTranslationAndPrefixAndSuffix()
{
$translate = new Translator('ArrayAdapter', array('My Label' => 'Translation'), 'en');
$translate->setLocale('en');
$element = new Element('foo');
$element->setView($this->getView())
->setLabel('My Label')
->setTranslator($translate);
$this->decorator->setElement($element)
->setOptions(array(
'optionalPrefix' => '> ',
'optionalSuffix' => ':',
'requiredPrefix' => '! ',
'requiredSuffix' => '*:',
));
$label = $this->decorator->getLabel();
$this->assertEquals('> Translation:', $label);
$element->setRequired(true);
$label = $this->decorator->getLabel();
$this->assertEquals('! Translation*:', $label);
}
示例3: setView
/**
* Set the view object
*
* Ensures that the view object has the dojo view helper path set.
*
* @param \Zend\View\Renderer $view
* @return \Zend\Dojo\Form\Element\Dijit
*/
public function setView(View $view = null)
{
if (null !== $view) {
if (false === $view->broker()->isLoaded('dojo')) {
$loader = new \Zend\Dojo\View\HelperLoader();
$view->broker()->getClassLoader()->registerPlugins($loader);
}
}
return parent::setView($view);
}