]> _ Git - fluidbook-toolbox.git/commitdiff
wait #6946 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 6 Jun 2024 12:43:39 +0000 (14:43 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 6 Jun 2024 12:43:39 +0000 (14:43 +0200)
app/Fields/Webflow/WebflowPage.php
app/Models/ToolWebflow.php
app/Services/Webflow.php

index e6f146d8bed77a87fc210ab10fa91b8e2c2a020c..b233c362e8c83c9d72c6eb7ba5ca0ef4474d6f7e 100644 (file)
@@ -11,7 +11,10 @@ class WebflowPage extends SelectFromArray
 
     public function getOptions()
     {
-        $params = \Route::current()->parameters();
+        $params = \Route::current()?->parameters();
+        if (null === $params) {
+            return [];
+        }
 
         $id =  // use the entity name to get the current entry
             // this makes sure the ID is corrent even for nested resources
index e2c0816f010b8eff344c141d228f390366137741..2ba0af9d2d24fa0fda05042cf50beb373829bff8 100644 (file)
@@ -3,7 +3,6 @@
 namespace App\Models;
 
 use App\Fields\Webflow\WebflowImages;
-use App\Fields\Webflow\WebflowPage;
 use App\Fields\Webflow\WebflowTexts;
 use App\Http\Controllers\Admin\Operations\Tools\StaticSiteUploader;
 use App\Http\Controllers\Admin\Operations\Tools\WebflowOperation;
@@ -27,7 +26,6 @@ use Cubist\Util\Json;
 use Illuminate\Contracts\Cache\Lock;
 use Illuminate\Contracts\Cache\LockTimeoutException;
 use Illuminate\Support\Facades\Cache;
-use Illuminate\Support\Facades\Session;
 
 // __('!! Outils')
 class ToolWebflow extends ToolboxTranslatableModel
@@ -64,7 +62,7 @@ class ToolWebflow extends ToolboxTranslatableModel
         $this->addField('texts', WebflowTexts::class, '', ['tab' => __('Textes'), 'translatable' => true, 'hint' => __('Modifier un texte ici ne produira aucun changement sur webflow')]);
         $this->addField('images', WebflowImages::class, '', ['tab' => __('Images'), 'translatable' => true]);
         $this->addField('seo', BunchOfFieldsMultiple::class, '', ['translatable' => true, 'edit_label' => '%url | %seo_title', 'allows_add' => false, 'allows_delete' => false, 'allows_clone' => false, 'allows_reorder' => false, 'bunch' => SEOPage::class, 'tab' => __('SEO')]);
-        $this->addField('redirections', BunchOfFieldsMultiple::class, '', ['translatable' => false, 'bunch' => Redirection::class, 'tab' => __('Redirections')]);
+        $this->addField('redirections', BunchOfFieldsMultiple::class, '', ['translatable' => false, 'edit_label' => '%from → %to', 'bunch' => Redirection::class, 'tab' => __('Redirections')]);
         $this->addField('api', Hidden::class);
     }
 
index 4cbf40fcf0a40c174d24e429b8d8a31a744fa6d4..905ad28dcb784d20eab19593dcbaea54482410dd 100644 (file)
@@ -112,7 +112,7 @@ class Webflow
             return $sites['sites'];
         }
         return [];
-   }
+    }
 
     public static function getSiteId($shortname)
     {
@@ -281,9 +281,8 @@ class Webflow
                     'og_description_copied' => $details['openGraph']['descriptionCopied'],
                 ];
 
-                $res['seo'][] = $seo;
+                $res['seo'][$pageID] = $seo;
 
-                $texts = [];
                 foreach ($page['contents'] as $node) {
                     if ($node['type'] === 'text') {
                         if (!$node['text']['text']) {
@@ -301,7 +300,7 @@ class Webflow
                         if (isset($res['images'][$assetId])) {
                             continue;
                         }
-                        $res['images'][] = ['id' => $assetId, 'alt' => $node['image']['alt'], 'url' => $data['assets'][$assetId]['hostedUrl']];
+                        $res['images'][$assetId] = ['id' => $assetId, 'alt' => $node['image']['alt'], 'url' => $data['assets'][$assetId]['hostedUrl']];
                     }
                 }
             }