Exemplo n.º 1
0
 /**
  * Constructor
  *
  * @param string  $type
  * @param string  $name
  * @param array   $value
  * @param array   $attribs
  */
 public function __construct($type, $name, $value, $attribs = array())
 {
     $attribs['type'] = $type;
     $attribs['name'] = $name;
     $attribs['value'] = $value;
     parent::__construct('input', null, $attribs);
 }
Exemplo n.º 2
0
 /**
  * toString
  *
  * @param bool $forcePair
  *
  * @return  string
  */
 public function toString($forcePair = false)
 {
     $tmpContent = clone $this->getContent();
     $tmpName = $this->getAttribute('name');
     $this->prepareOptions();
     if ($this->multiple) {
         $this->setAttribute('name', $this->getAttribute('name') . '[]');
     }
     $html = parent::toString($forcePair);
     $this->setAttribute('name', $tmpName);
     $this->setContent($tmpContent);
     return $html;
 }
Exemplo n.º 3
0
 /**
  * @param $text
  * @param $value
  * @param $attributes
  */
 public function __construct($text = null, $value = null, $attributes = array())
 {
     $this->value = $value;
     $attributes['value'] = $value;
     parent::__construct('option', $text, $attributes);
 }
 /**
  * Constructor.
  *
  * @param ListItem[] $items
  * @param array      $attribs
  */
 public function __construct($items = array(), $attribs = array())
 {
     parent::__construct($this->name, null, $attribs);
     $this->setItems((array) $items);
 }
Exemplo n.º 5
0
 /**
  * Constructor
  *
  * @param string     $name
  * @param mixed|null $options
  * @param array      $attribs
  * @param mixed      $checked
  */
 public function __construct($name, $options, $attribs = array(), $checked = null)
 {
     $attribs['name'] = $name;
     $this->checked = $checked;
     parent::__construct('span', $options, $attribs);
 }
 /**
  * Method to test create().
  *
  * @param string  $name
  * @param string  $expect
  * @param string  $tag
  * @param string  $content
  * @param array   $attribs
  * @param boolean $forcePaired
  *
  * @return void
  *
  * @covers       Windwalker\Dom\Builder\HtmlBuilder::create
  *
  * @dataProvider domTestCase
  */
 public function testCreate($name, $expect, $tag, $content, $attribs, $forcePaired)
 {
     $element = new HtmlElement($tag, $content, $attribs, $forcePaired);
     $this->assertEquals(DomHelper::minify($expect), DomHelper::minify($element->toString($forcePaired)), 'Dom build case fail: ' . $name);
 }
Exemplo n.º 7
0
 /**
  * Constructor
  *
  * @param mixed  $content Element content.
  * @param array  $attribs Element attributes.
  */
 public function __construct($content = null, $attribs = array())
 {
     parent::__construct('dt', $content, $attribs);
 }
 /**
  * Constructor.
  *
  * @param array   $attribs
  */
 public function __construct($attribs = array())
 {
     parent::__construct($this->name, null, $attribs);
     $this->content = new HtmlElements();
 }