From 732fe2296ec1db540377766050d47a604f5c8585 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 28 Aug 2024 15:23:53 +0200 Subject: [PATCH] wait #7051 @5 --- app/Models/ToolWebflow.php | 2 +- app/Services/Webflow.php | 5 +++-- app/SubForms/Webflow/SEOPage.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Models/ToolWebflow.php b/app/Models/ToolWebflow.php index 909539d4c..613ef425f 100644 --- a/app/Models/ToolWebflow.php +++ b/app/Models/ToolWebflow.php @@ -252,7 +252,7 @@ class ToolWebflow extends ToolboxTranslatableModel Api::setCache(Files::mkdir(protected_path('cache/azure_translate'))); $translateAPI = new Api(env('AZURE_TRANSLATE_API_KEY')); - $data = Json::decode($this->seo, Json::TYPE_ARRAY); + $data = $this->getTranslations('seo'); $data[$mainLocale] = $this->api['seo']; $seoTranslateProps = ['og_title', 'og_description', 'seo_title', 'seo_description']; foreach ($locales as $locale) { diff --git a/app/Services/Webflow.php b/app/Services/Webflow.php index 0d2e08e6f..439e3793c 100644 --- a/app/Services/Webflow.php +++ b/app/Services/Webflow.php @@ -288,10 +288,8 @@ class Webflow } } - $url = '/' . $url; - $seo = [ 'id' => $pageID, 'url' => $url, @@ -317,6 +315,7 @@ class Webflow $html = str_replace('
', "\n", $html); $texts = Html::getTextNodes($html); self::addTexts($texts, $res['texts']); + // dump($url, $texts); } else if ($node['type'] === 'image') { if (!isset($node['image']['assetId'])) { @@ -333,6 +332,7 @@ class Webflow if (is_file($mirrorPath . $url)) { $texts = Html::getTextNodes(file_get_contents($mirrorPath . $url)); self::addTexts($texts, $res['texts']); + // dump('--' . $url, $texts); } } @@ -363,6 +363,7 @@ class Webflow $texts = Html::getTextNodes($t); } self::addTexts($texts, $res['texts']); + //dump( $texts); } } } diff --git a/app/SubForms/Webflow/SEOPage.php b/app/SubForms/Webflow/SEOPage.php index fa6f36bd9..67ecfd527 100644 --- a/app/SubForms/Webflow/SEOPage.php +++ b/app/SubForms/Webflow/SEOPage.php @@ -18,7 +18,7 @@ class SEOPage extends SubForm $this->addField('url', HiddenVisible::class, __('URL')); $this->addField('type', HiddenVisible::class, __('Type')); $this->addField('draft', Checkbox::class, __('Brouillon'), ['when' => ['type' => ['operator' => 'not', 'value' => 'page_html']]]); - $this->addField('slug', Text::class, __('Slug') . ' (' . __('slug') . ')', ['when' => ['type' => 'page', 'url' => ['operator' => '!', 'value' => '/index.html']]]); + $this->addField('slug', Text::class, __('Slug') . ' (' . __('slug') . ')', ['when' => ['url' => ['operator' => '!', 'value' => '/index.html']]]); $this->addField('seo_title', Text::class, __('Titre'), ['when' => ['type' => ['page', 'page_html']]]); $this->addField('og_title_copied', Checkbox::class, __('Utiliser le titre ci-dessus pour les réseaux sociaux'), ['when' => ['type' => ['page_html', 'page']]]); $this->addField('og_title', Text::class, __('Titre pour les réseaux sociaux'), ['when' => ['og_title_copied' => '0', 'type' => ['page_html', 'page']]]); -- 2.39.5