コード例 #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);
 }
コード例 #2
0
ファイル: SelectList.php プロジェクト: rokite/windwalker
 /**
  * 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;
 }
コード例 #3
0
ファイル: Option.php プロジェクト: rokite/windwalker
 /**
  * @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);
 }
コード例 #4
0
 /**
  * Constructor.
  *
  * @param ListItem[] $items
  * @param array      $attribs
  */
 public function __construct($items = array(), $attribs = array())
 {
     parent::__construct($this->name, null, $attribs);
     $this->setItems((array) $items);
 }
コード例 #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);
 }
コード例 #6
0
 /**
  * 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);
 }
コード例 #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);
 }
コード例 #8
0
 /**
  * Constructor.
  *
  * @param array   $attribs
  */
 public function __construct($attribs = array())
 {
     parent::__construct($this->name, null, $attribs);
     $this->content = new HtmlElements();
 }