/**
  * Initialize $this->currentLinkParts
  *
  * @return void
  */
 protected function initCurrentUrl()
 {
     $currentLink = isset($this->parameters['currentValue']) ? trim($this->parameters['currentValue']) : '';
     $currentLinkParts = GeneralUtility::makeInstance(TypoLinkCodecService::class)->decode($currentLink);
     $currentLinkParts['params'] = $currentLinkParts['additionalParams'];
     unset($currentLinkParts['additionalParams']);
     $this->currentLinkParts = $currentLinkParts;
     parent::initCurrentUrl();
 }
Beispiel #2
0
 /**
  * Initialize $this->currentLinkParts
  *
  * @return void
  */
 protected function initCurrentUrl()
 {
     $currentLink = isset($this->parameters['currentValue']) ? trim($this->parameters['currentValue']) : '';
     $currentLinkParts = GeneralUtility::makeInstance(TypoLinkCodecService::class)->decode($currentLink);
     $currentLinkParts['params'] = $currentLinkParts['additionalParams'];
     unset($currentLinkParts['additionalParams']);
     if (!empty($currentLinkParts['url'])) {
         $linkService = GeneralUtility::makeInstance(LinkService::class);
         $data = $linkService->resolve($currentLinkParts['url']);
         $currentLinkParts['type'] = $data['type'];
         unset($data['type']);
         $currentLinkParts['url'] = $data;
     }
     $this->currentLinkParts = $currentLinkParts;
     parent::initCurrentUrl();
 }
 /**
  * Initialize $this->currentLink and $this->currentLinkHandler
  *
  * @return void
  */
 protected function initCurrentUrl()
 {
     if (empty($this->currentLinkParts)) {
         return;
     }
     if (empty($this->currentLinkParts['data-htmlarea-external'])) {
         // strip siteUrl prefix except for external and mail links
         if (strpos($this->currentLinkParts['url'], 'mailto:') === false) {
             $paramsPosition = strpos($this->currentLinkParts['url'], '?');
             if ($paramsPosition !== false) {
                 $this->currentLinkParts['url'] = substr($this->currentLinkParts['url'], $paramsPosition + 1);
             }
         }
         // special treatment for page links, remove the id= part
         $idPosition = strpos($this->currentLinkParts['url'], 'id=');
         if ($idPosition !== false) {
             $this->currentLinkParts['url'] = substr($this->currentLinkParts['url'], $idPosition + 3);
         }
         // in RTE the additional params are encoded directly at the end of the href part
         // we need to split this again into dedicated fields
         $additionalParamsPosition = strpos($this->currentLinkParts['url'], '?');
         if ($additionalParamsPosition === false) {
             $additionalParamsPosition = strpos($this->currentLinkParts['url'], '&');
         }
         if ($additionalParamsPosition !== false) {
             $this->currentLinkParts['params'] = substr($this->currentLinkParts['url'], $additionalParamsPosition);
             $this->currentLinkParts['url'] = substr($this->currentLinkParts['url'], 0, $additionalParamsPosition);
             // in case the first sign was an ? override it with &
             $this->currentLinkParts['params'][0] = '&';
         }
     }
     parent::initCurrentUrl();
 }
Beispiel #4
0
 /**
  * Initialize $this->currentLink and $this->currentLinkHandler
  *
  * @return void
  */
 protected function initCurrentUrl()
 {
     if (empty($this->currentLinkParts)) {
         return;
     }
     if (!empty($this->currentLinkParts['url'])) {
         $linkService = GeneralUtility::makeInstance(LinkService::class);
         $data = $linkService->resolve($this->currentLinkParts['url']);
         $this->currentLinkParts['type'] = $data['type'];
         unset($data['type']);
         $this->currentLinkParts['url'] = $data;
     }
     if (!empty($this->currentLinkParts['class'])) {
         // Only keep last class value (others are automatically added again by required option)
         // https://review.typo3.org/#/c/29643
         $currentClasses = GeneralUtility::trimExplode(' ', $this->currentLinkParts['class'], true);
         if (count($currentClasses) > 1) {
             $this->currentLinkParts['class'] = end($currentClasses);
         }
     }
     parent::initCurrentUrl();
 }
Beispiel #5
0
 /**
  * Initialize $this->currentLink and $this->currentLinkHandler
  *
  * @return void
  */
 protected function initCurrentUrl()
 {
     if (empty($this->currentLinkParts)) {
         return;
     }
     if (!empty($this->currentLinkParts['url'])) {
         $linkService = GeneralUtility::makeInstance(LinkService::class);
         $data = $linkService->resolve($this->currentLinkParts['url']);
         $this->currentLinkParts['type'] = $data['type'];
         unset($data['type']);
         $this->currentLinkParts['url'] = $data;
     }
     if (!empty($this->currentLinkParts['class'])) {
         // remove required classes
         $currentClasses = GeneralUtility::trimExplode(' ', $this->currentLinkParts['class'], true);
         if (count($currentClasses) > 1) {
             $this->currentLinkParts['class'] = end($currentClasses);
         }
     }
     parent::initCurrentUrl();
 }