/** * @param Element $element */ public function addElement($element) { $options = $element->getOptions(); $options['displayGroup'] = $this->getName(); $element->setOptions($options); $this->elements[$element->getName()] = $element; return $this; }
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; }
/** * Add element to stack * * @param Element $element * @return DisplayGroup */ public function addElement(Element $element) { $this->_elements[$element->getName()] = $element; $this->_groupUpdated = true; return $this; }
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()); }
/** * 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(); }
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); }
public function testCanPassNameToConstructor() { $element = new Element('foo'); $this->assertEquals('foo', $element->getName()); }
/** * @inheritdoc */ public function getName() { return $this->element->getName(); }