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