vendor/pimcore/pimcore/lib/Navigation/Page/Document.php line 138

Open in your IDE?
  1. <?php
  2. /**
  3.  * Pimcore
  4.  *
  5.  * This source file is available under two different licenses:
  6.  * - GNU General Public License version 3 (GPLv3)
  7.  * - Pimcore Commercial License (PCL)
  8.  * Full copyright and license information is available in
  9.  * LICENSE.md which is distributed with this source code.
  10.  *
  11.  *  @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  12.  *  @license    http://www.pimcore.org/license     GPLv3 and PCL
  13.  */
  14. namespace Pimcore\Navigation\Page;
  15. use Pimcore\Model;
  16. class Document extends Url
  17. {
  18.     /**
  19.      * @var string|null
  20.      */
  21.     protected ?string $_accesskey null;
  22.     /**
  23.      * @var string|null
  24.      */
  25.     protected ?string $_tabindex null;
  26.     /**
  27.      * @var string|null
  28.      */
  29.     protected ?string $_relation null;
  30.     /**
  31.      * @var int
  32.      */
  33.     protected $_documentId;
  34.     /**
  35.      * @var string
  36.      */
  37.     protected $documentType;
  38.     /**
  39.      * @var string
  40.      */
  41.     protected $realFullPath;
  42.     /**
  43.      * @var array
  44.      */
  45.     protected $customSettings = [];
  46.     /**
  47.      * @param string $tabindex
  48.      *
  49.      * @return $this
  50.      */
  51.     public function setTabindex($tabindex)
  52.     {
  53.         $this->_tabindex $tabindex;
  54.         return $this;
  55.     }
  56.     /**
  57.      * @return string
  58.      */
  59.     public function getTabindex()
  60.     {
  61.         return $this->_tabindex;
  62.     }
  63.     /**
  64.      * @param string|null $character
  65.      *
  66.      * @return $this
  67.      */
  68.     public function setAccesskey(?string $character null)
  69.     {
  70.         $this->_accesskey $character;
  71.         return $this;
  72.     }
  73.     /**
  74.      * @return string|null
  75.      */
  76.     public function getAccesskey(): ?string
  77.     {
  78.         return $this->_accesskey;
  79.     }
  80.     /**
  81.      * @param string $relation
  82.      *
  83.      * @return $this
  84.      */
  85.     public function setRelation($relation)
  86.     {
  87.         $this->_relation $relation;
  88.         return $this;
  89.     }
  90.     /**
  91.      * @return string
  92.      */
  93.     public function getRelation()
  94.     {
  95.         return $this->_relation;
  96.     }
  97.     /**
  98.      * @param Model\Document $document
  99.      *
  100.      * @return $this
  101.      */
  102.     public function setDocument($document)
  103.     {
  104.         $this->setDocumentId($document->getId());
  105.         $this->setDocumentType($document->getType());
  106.         $this->setRealFullPath($document->getRealFullPath());
  107.         return $this;
  108.     }
  109.     /**
  110.      * @return Model\Document|null
  111.      */
  112.     public function getDocument()
  113.     {
  114.         $docId $this->getDocumentId();
  115.         if ($docId) {
  116.             $doc Model\Document::getById($docId);
  117.             if ($doc instanceof Model\Document\Hardlink) {
  118.                 $doc Model\Document\Hardlink\Service::wrap($doc);
  119.             }
  120.             return $doc;
  121.         }
  122.         return null;
  123.     }
  124.     /**
  125.      * @return int
  126.      */
  127.     public function getDocumentId()
  128.     {
  129.         return $this->_documentId;
  130.     }
  131.     /**
  132.      * @param int $documentId
  133.      */
  134.     public function setDocumentId($documentId)
  135.     {
  136.         $this->_documentId $documentId;
  137.     }
  138.     /**
  139.      * @return string
  140.      */
  141.     public function getDocumentType()
  142.     {
  143.         return $this->documentType;
  144.     }
  145.     /**
  146.      * @param string $documentType
  147.      */
  148.     public function setDocumentType($documentType)
  149.     {
  150.         $this->documentType $documentType;
  151.     }
  152.     /**
  153.      * @return string
  154.      */
  155.     public function getRealFullPath()
  156.     {
  157.         return $this->realFullPath;
  158.     }
  159.     /**
  160.      * @param string $realFullPath
  161.      */
  162.     public function setRealFullPath($realFullPath)
  163.     {
  164.         $this->realFullPath $realFullPath;
  165.     }
  166.     /**
  167.      * @param string $name
  168.      * @param mixed $value
  169.      *
  170.      * @return $this
  171.      */
  172.     public function setCustomSetting($name$value)
  173.     {
  174.         $this->customSettings[$name] = $value;
  175.         return $this;
  176.     }
  177.     /**
  178.      * @param string $name
  179.      *
  180.      * @return mixed
  181.      */
  182.     public function getCustomSetting($name)
  183.     {
  184.         if (array_key_exists($name$this->customSettings)) {
  185.             return $this->customSettings[$name];
  186.         }
  187.         return null;
  188.     }
  189. }