| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace ThurData\Servers\KerioEmail\Core\UI\Traits;
- /**
- * Html Attributes related functions
- *
- * @autor ThurData <info@thurdata.ch>
- */
- trait HtmlAttributes
- {
- protected $htmlAttributes = [];
-
- public function getHtmlAttributes()
- {
- return $this->htmlAttributes;
- }
-
- public function addHtmlAttribute($key, $value)
- {
- $this->htmlAttributes[$key] = $value;
-
- return $this;
- }
-
- public function getHtmlAttribute($key)
- {
- return $this->htmlAttributes[$key];
- }
-
- public function deleteHtmlAttribute($key)
- {
- unset($this->htmlAttributes[$key]);
-
- return $this;
- }
-
- public function setHtmlAttributes(array $attribuetsList = [])
- {
- $this->htmlAttributes = $attribuetsList;
- return $this;
- }
-
- public function initOnClickVue($vueMethod = 'submitForm')
- {
- $stringClick = (string)$vueMethod . "(";
- $argsCount = 0;
- foreach (func_get_args() as $param)
- {
- if ($param === $vueMethod)
- {
- continue;
- }
- if ($argsCount > 0)
- {
- $stringClick .= ',';
- }
- $stringClick .= $param;
- $argsCount++;
- }
- $stringClick .= ")";
- $this->htmlAttributes['@click'] = $stringClick;
-
- return $this;
- }
- }
|