本文整理汇总了PHP中Zend_Form_Element::setView方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element::setView方法的具体用法?PHP Zend_Form_Element::setView怎么用?PHP Zend_Form_Element::setView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element
的用法示例。
在下文中一共展示了Zend_Form_Element::setView方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setView
/**
* Set the view object
*
* Ensures that the view object has the jQuery view helper path set.
*
* @param Zend_View_Interface $view
* @return ZendX_JQuery_Form_Element_UiWidget
*/
public function setView(Zend_View_Interface $view = null)
{
if (null !== $view) {
if (false === $view->getPluginLoader('helper')->getPaths('ZendX_JQuery_View_Helper')) {
$view->addHelperPath('ZendX/JQuery/View/Helper', 'ZendX_JQuery_View_Helper');
}
}
return parent::setView($view);
}
示例2: testRetrievingLabelRetrievesLabelWithTranslationAndPrefixAndSuffix
public function testRetrievingLabelRetrievesLabelWithTranslationAndPrefixAndSuffix()
{
require_once 'Zend/Translate.php';
$translate = new Zend_Translate('array', array('My Label' => 'Translation'), 'en');
$translate->setLocale('en');
$element = new Zend_Form_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: testLabelIsNotTranslatedTwice
/**
* @group ZF-8694
*/
public function testLabelIsNotTranslatedTwice()
{
// Init translator
require_once 'Zend/Translate.php';
$translate = new Zend_Translate(array('adapter' => 'array', 'content' => array('firstLabel' => 'secondLabel', 'secondLabel' => 'thirdLabel'), 'locale' => 'en'));
// Create element
$element = new Zend_Form_Element('foo');
$element->setView($this->getView())->setLabel('firstLabel')->setTranslator($translate);
$this->decorator->setElement($element);
// Test
$this->assertEquals('secondLabel', $this->decorator->getLabel());
}
示例4: testDescriptionIsNotTranslatedTwice
/**
* @group ZF-8694
*/
public function testDescriptionIsNotTranslatedTwice()
{
// Init translator
require_once 'Zend/Translate.php';
$translate = new Zend_Translate(array('adapter' => 'array', 'content' => array('firstDescription' => 'secondDescription', 'secondDescription' => 'thirdDescription'), 'locale' => 'en'));
// Create element
$element = new Zend_Form_Element('foo');
$element->setView($this->getView())->setDescription('firstDescription')->setTranslator($translate);
$this->decorator->setElement($element);
// Test
$this->assertEquals('<p class="hint">secondDescription</p>', trim($this->decorator->render('')));
}
示例5: testRenderAppendsOnRequest
public function testRenderAppendsOnRequest()
{
$element = new Zend_Form_Element('foo');
$element->setView($this->getView())
->setLabel('My Label');
$this->decorator->setElement($element)
->setOptions(array('placement' => 'APPEND'));
$content = 'test content';
$test = $this->decorator->render($content);
$this->assertRegexp('#' . $content . '.*?<label#s', $test);
}
示例6: testRenderImplicitAppendsOnRequest
/**
* @group ZF-6667
*/
public function testRenderImplicitAppendsOnRequest()
{
$element = new Zend_Form_Element('foo');
$element->setView($this->getView())->setLabel('My Label');
$this->decorator->setElement($element)->setOptions(array('placement' => 'IMPLICIT_APPEND', 'separator' => ' '));
$content = 'test content';
$actual = $this->decorator->render($content);
$expected = '<label class="optional">test content My Label</label>';
$this->assertEquals($expected, $actual);
}