vendor/pimcore/pimcore/models/Document/Editable/Area/Info.php line 22

  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\Area;
  16. use Pimcore\Model\Document;
  17. use Pimcore\Model\Document\Editable;
  18. use Symfony\Component\HttpFoundation\Request;
  19. class Info
  20. {
  21.     /**
  22.      * @internal
  23.      *
  24.      */
  25.     protected ?string $id null;
  26.     /**
  27.      * @internal
  28.      *
  29.      */
  30.     protected ?Editable $editable null;
  31.     /**
  32.      * @internal
  33.      *
  34.      */
  35.     protected array $params = [];
  36.     /**
  37.      * @internal
  38.      *
  39.      */
  40.     protected ?Request $request null;
  41.     /**
  42.      * @internal
  43.      *
  44.      */
  45.     protected ?string $type null;
  46.     /**
  47.      * @internal
  48.      *
  49.      */
  50.     protected ?int $index null;
  51.     public function getId(): ?string
  52.     {
  53.         return $this->id;
  54.     }
  55.     public function setId(?string $id): static
  56.     {
  57.         $this->id $id;
  58.         return $this;
  59.     }
  60.     public function getEditable(): ?Editable
  61.     {
  62.         return $this->editable;
  63.     }
  64.     public function setEditable(Editable $editable): void
  65.     {
  66.         $this->editable $editable;
  67.     }
  68.     public function getType(): ?string
  69.     {
  70.         return $this->type;
  71.     }
  72.     public function setType(?string $type): static
  73.     {
  74.         $this->type $type;
  75.         return $this;
  76.     }
  77.     public function getParams(): array
  78.     {
  79.         return $this->params;
  80.     }
  81.     public function getParam(string $name): mixed
  82.     {
  83.         if (isset($this->params[$name])) {
  84.             return $this->params[$name];
  85.         }
  86.         return null;
  87.     }
  88.     public function setParam(string $namemixed $value): static
  89.     {
  90.         $this->params[$name] = $value;
  91.         return $this;
  92.     }
  93.     public function setParams(array $params): static
  94.     {
  95.         $this->params $params;
  96.         return $this;
  97.     }
  98.     public function getRequest(): ?Request
  99.     {
  100.         return $this->request;
  101.     }
  102.     public function setRequest(Request $request): static
  103.     {
  104.         $this->request $request;
  105.         return $this;
  106.     }
  107.     public function setIndex(?int $index): static
  108.     {
  109.         $this->index $index;
  110.         return $this;
  111.     }
  112.     public function getIndex(): ?int
  113.     {
  114.         return $this->index;
  115.     }
  116.     public function getDocument(): Document\PageSnippet
  117.     {
  118.         return $this->editable->getDocument();
  119.     }
  120.     /**
  121.      *
  122.      *
  123.      * @throws \Exception
  124.      */
  125.     public function getDocumentElement(string $namestring $type ''): ?Editable
  126.     {
  127.         $editable null;
  128.         $document $this->getDocument();
  129.         if ($document instanceof Document\PageSnippet) {
  130.             $name Editable::buildEditableName($type$name$document);
  131.             $editable $document->getEditable($name);
  132.         }
  133.         return $editable;
  134.     }
  135. }