TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
FullyRenderedButton.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Backend\Template\Components\Buttons;
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
33 {
41  protected $htmlSource = '';
42 
48  public function getHtmlSource()
49  {
50  return $this->htmlSource;
51  }
52 
60  public function setHtmlSource($htmlSource)
61  {
62  $this->htmlSource = $htmlSource;
63  return $this;
64  }
65 
71  public function getType()
72  {
73  return get_class($this);
74  }
75 
81  public function isValid()
82  {
83  if (
84  trim($this->getHtmlSource()) !== ''
85  && $this->getType() === self::class
86  ) {
87  return true;
88  }
89  return false;
90  }
91 
97  public function __toString()
98  {
99  return $this->render();
100  }
101 
107  public function render()
108  {
109  return '<span class="btn btn-sm btn-default">' . $this->getHtmlSource() . '</span>';
110  }
111 }