Quellcode durchsuchen

mrm_be:tileexternal fix select link & prefilled xml

jabongwa vor 2 Jahren
Ursprung
Commit
e5b23b2023

+ 51 - 9
Classes/Hooks/TCE/TCEMainHook.php

@@ -2069,17 +2069,59 @@ class TCEMainHook
   private function processLink($link, $dbReference, &$processedData)
   {
     $cleanedLink = [];
+
     if (substr($link, 0, 2) === 't3') {
-      $parts = explode(' ', $link);
-      $cleanedLink['href'] = $this->replaceT3Link($parts[0], $dbReference, $processedData);
-      $cleanedLink['target'] = '_top';
-      //$cleanedLink['title'] = $parts[3] ?? '';
+
+      if ((strpos($link, '_') !== false) && (strpos($link, '-') !== false)) {
+
+        $parts = explode(' ', $link);
+        $cleanedLink['href'] = $this->replaceT3Link($parts[0], $dbReference, $processedData);
+        $cleanedLink['target'] = $parts[1] ?? '_top';
+      } else if ((strpos($link, '_') === false) && (strpos($link, '-') !== false)) {
+        $parts = explode(' - ', $link);
+        $cleanedLink['href'] = $this->replaceT3Link($parts[0], $dbReference, $processedData);
+        $cleanedLink['target'] = '_top';
+      } else if ((strpos($link, '_') !== false) && (strpos($link, '-') === false)) {
+        $parts = explode(' ', $link);
+        $cleanedLink['href'] = $this->replaceT3Link($parts[0], $dbReference, $processedData);
+        $cleanedLink['target'] = $parts[1];
+      } else {
+        $cleanedLink['href'] = $this->replaceT3Link($link, $dbReference, $processedData);
+        $cleanedLink['target'] = '_top';
+      }
     } else {
-      $parts = explode(' ', $link);
-      $cleanedLink['href'] = $parts[0];
-      $cleanedLink['target'] = '_blank';
-      //$cleanedLink['title'] = $parts[3] ?? '';
+      if ((strpos($link, '_') !== false) && (strpos($link, '-') !== false)) {
+
+        $parts = explode(' - ', $link);
+        if (count($parts) > 0) {
+          $subparts = $parts[0];
+          if (strpos($link, '_') !== false) {
+            $newparts = explode(' ', $subparts);
+            $cleanedLink['href'] = $newparts[0];
+            $cleanedLink['target'] = $newparts[1];
+          }
+        }
+      } else if ((strpos($link, '_') !== false) && (strpos($link, '-') === false)) {
+        $parts = explode(' ', $link);
+        if (count($parts) > 0) {
+          $cleanedLink['href'] = $parts[0];
+          $cleanedLink['target'] = $parts[1];
+        }
+      } else if ((strpos($link, '_') === false) && (strpos($link, '-') !== false)) {
+        $parts = explode(' ', $link);
+        if (count($parts) > 0) {
+          $cleanedLink['href'] = $parts[0];
+          $cleanedLink['target'] = '_blank';
+        }
+      } else if ((strpos($link, '_') === false) && (strpos($link, '-') === false)) {
+        $parts = explode(' ', $link);
+        if (count($parts) > 0) {
+          $cleanedLink['href'] = $parts[0];
+          $cleanedLink['target'] = '_blank';
+        }
+      }
     }
+
     return $cleanedLink;
   }
 
@@ -2525,6 +2567,6 @@ class TCEMainHook
     if (!$isString) {
       $msg = json_encode($msg, JSON_PRETTY_PRINT);
     }
-      file_put_contents('/var/www/html/public/typo3temp/debug.log', $msg . PHP_EOL, FILE_APPEND);
+    file_put_contents('/var/www/html/public/typo3temp/debug.log', $msg . PHP_EOL, FILE_APPEND);
   }
 }

+ 1 - 1
Configuration/FlexForms/extra-infosbox-prefilled.xml

@@ -285,7 +285,7 @@
                 <size>100</size>
                 <max>120</max>
                 <eval>trim</eval>
-                <default>https://www.check-u.de</default>
+                <default>http://www.check-u.de</default>
               </config>
             </TCEforms>
           </checkuurl>