From a7f31f0f3bf85f9625885ef9c99548ebe57b861d Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 6 Jun 2024 14:43:39 +0200 Subject: [PATCH] wait #6946 @1.5 --- app/Fields/Webflow/WebflowPage.php | 5 ++++- app/Models/ToolWebflow.php | 4 +--- app/Services/Webflow.php | 7 +++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/Fields/Webflow/WebflowPage.php b/app/Fields/Webflow/WebflowPage.php index e6f146d8b..b233c362e 100644 --- a/app/Fields/Webflow/WebflowPage.php +++ b/app/Fields/Webflow/WebflowPage.php @@ -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 diff --git a/app/Models/ToolWebflow.php b/app/Models/ToolWebflow.php index e2c0816f0..2ba0af9d2 100644 --- a/app/Models/ToolWebflow.php +++ b/app/Models/ToolWebflow.php @@ -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); } diff --git a/app/Services/Webflow.php b/app/Services/Webflow.php index 4cbf40fcf..905ad28dc 100644 --- a/app/Services/Webflow.php +++ b/app/Services/Webflow.php @@ -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']]; } } } -- 2.39.5