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