Esempio n. 1
0
 /**
  * Returns the data for the given lazy object storage
  * @param \TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy $proxy
  * @param string $propertyKey
  * @param \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $model
  * @return array<mixed>
  */
 public function getModelDataFromLazyLoadingProxy($proxy, $propertyKey, $model)
 {
     $returnData = array();
     /*
      * Get the first level of nested objects and all built in TYPO3
      * categories
      */
     if ($this->currentModelDataDepth < 1 && $model instanceof \TYPO3\CMS\Extbase\Domain\Model\Category) {
         $this->currentModelDataDepth++;
         $returnData = $this->getModelData($proxy->_loadRealInstance());
         $this->currentModelDataDepth--;
     }
     return $returnData;
 }
Esempio n. 2
-1
 /**
  * @param \CIC\Cicbase\Domain\Model\File|\TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy|\TYPO3\CMS\Extbase\Domain\Model\FileReference $file
  * @param string $class
  * @param string $linkText
  * @return string
  */
 public function render($file, $class = null, $linkText = null)
 {
     if ($file instanceof \TYPO3\CMS\Extbase\Domain\Model\FileReference) {
         $uri = $file->getOriginalResource()->getPublicUrl();
     } elseif ($file) {
         $uri = $file->getPathAndFileName();
     } else {
         return '';
     }
     if ($linkText) {
         $text = $linkText;
     } elseif ($file->getTitle()) {
         $text = $file->getTitle();
     } else {
         $text = $file->getOriginalFilename();
     }
     if ($class) {
         $classAttr = 'class="' . $class . '"';
     } else {
         $classAttr = '';
     }
     return '<a target="_blank" href="' . $uri . '" ' . $classAttr . '>' . $text . '</a>';
 }