本文整理汇总了PHP中Zend\Form\Element::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Element::getName方法的具体用法?PHP Element::getName怎么用?PHP Element::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\Element
的用法示例。
在下文中一共展示了Element::getName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addElement
/**
* @param Element $element
*/
public function addElement($element)
{
$options = $element->getOptions();
$options['displayGroup'] = $this->getName();
$element->setOptions($options);
$this->elements[$element->getName()] = $element;
return $this;
}
示例2: __invoke
public function __invoke(Element $element)
{
$value = $element->getValue();
if (!$value) {
$value = 'default';
}
$view = $this->getView();
$default = $view->escapeHtmlAttr($view->basePath('img/avatars/' . $value . '.png'));
$id = uniqid('dialog-', false);
$element->setOption('dialog_id', $id);
$name = $view->escapeHtmlAttr($element->getName());
$html = <<<EOT
<div class="zource-avatar-selection zui-file-selection-trigger-container" data-zui-file-selection-trigger="#file-selection-{$id}">
<input type="hidden" name="{$name}" value="{$value}">
<p>
<img src="{$default}" alt="Avatar" tabindex="1" class="zui-file-selection-trigger-thumb">
</p>
</div>
EOT;
return $html;
}
示例3: addElement
/**
* Add element to stack
*
* @param Element $element
* @return DisplayGroup
*/
public function addElement(Element $element)
{
$this->_elements[$element->getName()] = $element;
$this->_groupUpdated = true;
return $this;
}
示例4: testSetOptionsIsTraversable
public function testSetOptionsIsTraversable()
{
$element = new Element('foo');
$element->setOptions(new \ArrayObject(array('foo' => 'bar')));
$this->assertEquals('foo', $element->getName());
$this->assertEquals(array('foo' => 'bar'), $element->getOptions());
}
示例5: renderLabel
/**
* Render element label
*
* @param \Zend\Form\Element $element
* @param \Zend\View\Renderer $view
* @return string
*/
public function renderLabel(Form\Element $element, View $view)
{
$label = $element->getLabel();
if (empty($label)) {
$label = $element->getName();
}
return $this->getMarkupElementLabelStart() . $view->vars()->escape($label) . $this->getMarkupElementLabelEnd();
}
示例6: testPassingConfigObjectToConstructorSetsObjectState
public function testPassingConfigObjectToConstructorSetsObjectState()
{
$config = new Config($this->getOptions());
$element = new Element($config);
$this->assertEquals('changed', $element->getName());
$this->assertEquals('foo', $element->getValue());
$this->assertEquals('bar', $element->getLabel());
$this->assertEquals(50, $element->getOrder());
$this->assertFalse($element->isRequired());
$this->assertEquals('bar', $element->foo);
$this->assertEquals('bat', $element->baz);
}
示例7: testCanPassNameToConstructor
public function testCanPassNameToConstructor()
{
$element = new Element('foo');
$this->assertEquals('foo', $element->getName());
}
示例8: getName
/**
* @inheritdoc
*/
public function getName()
{
return $this->element->getName();
}