HtmlObject\Traits\Tag::render PHP Method

render() public method

Default rendering method.
public render ( ) : string | null
return string | null
    public function render()
    {
        // If it's a self closing tag
        if ($this->isSelfClosing) {
            return $this->open();
        }
        return $this->open() . $this->getContent() . $this->close();
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @return string
  */
 public function render()
 {
     $value = $this->choices->all();
     if (!empty($this->label)) {
         $label = Element::create('label', $this->label);
         $this->nest($label, 'label');
         $this->nest('<br>');
     }
     $this->nest($value, 'choices');
     return parent::render();
 }