File: D:/HostingSpaces/Neopoints/momsecurity.be/vendor/komma/kms/src/Core/Attributes/TextArea.php
<?php
namespace Komma\KMS\Core\Attributes;
use Komma\KMS\Core\Attributes\Interfaces\HasLabelInterface;
use Komma\KMS\Core\Attributes\Traits\ExplanationTrait;
use Komma\KMS\Core\Attributes\Traits\LabelTrait;
use Komma\KMS\Core\Attributes\Traits\PlaceholderTextTrait;
use Komma\KMS\Core\Attributes\Traits\ReadOnlyTrait;
class TextArea extends Attribute implements HasLabelInterface
{
use LabelTrait;
use PlaceholderTextTrait;
use ReadOnlyTrait;
use ExplanationTrait;
private int $height;
private array $styleFormats = [];
private string $contentCssUrl = '';
private bool $withForecolorPicker = false;
private array $colorMap = [];
private bool $withCustomColor = false;
private bool $withEmoticons = false;
private bool $tinymceEditor = false;
/**
* Returns a view that visually represents this attribute
*/
public function render(): string
{
return view('KMS::attributes.textArea', [
'attribute' => $this
])->render();
}
/**
* @return bool
*/
public function hasTinymceEditor(): bool
{
return $this->tinymceEditor;
}
/**
* @return TextArea
*/
public function enableTinymceEditor(): TextArea
{
$this->tinymceEditor = true;
return $this;
}
/**
* Get the height of a textarea (for when TinyMCE is not enabled).
*
* @return int
*/
public function getHeight(): int
{
return $this->height;
}
/**
* Has the textarea a height defined.
*
* @return bool
*/
public function hasHeight(): bool
{
return isset($this->height);
}
/**
* Set the height of a textarea (for when TinyMCE is not enabled).
*
* @param int $height
* @return TextArea
*/
public function setHeight(int $height): TextArea
{
$this->height = $height;
return $this;
}
/**
* Set the style format by the config key
*
* @param string $configKey
* @return $this
*/
public function setStyleFormatFromConfig(string $configKey = 'kms.text_area_style_formats'): TextArea
{
$this->styleFormats = config($configKey);
return $this;
}
/**
* Get the style formats
*
* @return array
*/
public function getStyleFormat(): array
{
return $this->styleFormats;
}
/**
* Set the url for the content css file
*
* @param string $contentCssUrl
* @return $this
*/
public function setContentCssUrl(string $contentCssUrl): TextArea
{
$this->contentCssUrl = $contentCssUrl;
return $this;
}
/**
* Get the url for the content css file
*
* @return string
*/
public function getContentCssUrl(): string
{
return $this->contentCssUrl;
}
/**
* @param bool
* @return $this
*/
public function enableForecolorPicker(bool $allowCustomColor = false): TextArea
{
$this->withForecolorPicker = true;
$this->withCustomColor = $allowCustomColor;
if(sizeof($this->colorMap) === 0) $this->setColorMap();
return $this;
}
/**
* @return bool
*/
public function withForecolorPicker(): bool
{
return $this->withForecolorPicker;
}
/**
* Set the color map config key
*
* @param string $configKey
* @return $this
*/
public function setColorMap(string $configKey = 'kms.tinymce_color_map'): TextArea
{
$this->colorMap = config($configKey);
return $this;
}
/**
* Get the color map for the forecolor picker
*
* @return array
*/
public function getColorMap(): array
{
return $this->colorMap;
}
/**
* @return bool
*/
public function allowCustomColor(): bool
{
return $this->withCustomColor;
}
/**
* @param bool
* @return $this
*/
public function enableEmoticons(): TextArea
{
$this->withEmoticons = true;
return $this;
}
/**
* @return bool
*/
public function withEmoticons(): bool
{
return $this->withEmoticons;
}
}