HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/shop.komma.nl/vendor/komma/kms/src/Core/Attributes/TextField.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 TextField
 * @package App\Kms\Core\Attributes
 */
class TextField extends Attribute implements HasLabelInterface
{
    use LabelTrait;
    use PlaceholderTextTrait;
    use ReadOnlyTrait;
    use ExplanationTrait;

    /**
     * A javascript regex pattern that is used to define how the text field should be entered.
     * @example [A-Za-z]{3}.
     * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
     */
    private string $pattern;

    /**
     * Returns a view that visually represents this attribute
     */
    public function render(): string
    {
        return view('KMS::attributes.textField', [
            'attribute' => $this
        ])->render();
    }

    /**
     * @return bool
     */
    public function hasPattern(): bool
    {
        return isset($this->pattern);
    }

    /**
     * @return string
     */
    public function getPattern(): ?string
    {
        return $this->pattern;
    }

    /**
     * @param string $pattern
     * @return TextField
     */
    public function setPattern(string $pattern): TextField
    {
        $this->pattern = $pattern;
        return $this;
    }
}