vendor/pimcore/pimcore/models/Document/Editable/Select.php line 23

  1. <?php
  2. declare(strict_types=1);
  3. /**
  4.  * Pimcore
  5.  *
  6.  * This source file is available under two different licenses:
  7.  * - GNU General Public License version 3 (GPLv3)
  8.  * - Pimcore Commercial License (PCL)
  9.  * Full copyright and license information is available in
  10.  * LICENSE.md which is distributed with this source code.
  11.  *
  12.  *  @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  13.  *  @license    http://www.pimcore.org/license     GPLv3 and PCL
  14.  */
  15. namespace Pimcore\Model\Document\Editable;
  16. use Pimcore\Model;
  17. /**
  18.  * @method \Pimcore\Model\Document\Editable\Dao getDao()
  19.  */
  20. class Select extends Model\Document\Editable
  21. {
  22.     /**
  23.      * Contains the current selected value
  24.      *
  25.      * @internal
  26.      */
  27.     protected ?string $text null;
  28.     public function getType(): string
  29.     {
  30.         return 'select';
  31.     }
  32.     public function getData(): mixed
  33.     {
  34.         return (string) $this->text;
  35.     }
  36.     public function getText(): string
  37.     {
  38.         return $this->getData();
  39.     }
  40.     public function frontend()
  41.     {
  42.         return $this->text;
  43.     }
  44.     public function setDataFromResource(mixed $data): static
  45.     {
  46.         $this->text = (string)$data;
  47.         return $this;
  48.     }
  49.     public function setDataFromEditmode(mixed $data): static
  50.     {
  51.         $this->text = (string)$data;
  52.         return $this;
  53.     }
  54.     public function isEmpty(): bool
  55.     {
  56.         return empty($this->text);
  57.     }
  58. }