]> _ Git - fluidbook-toolbox.git/commitdiff
wait #7051 @5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 28 Aug 2024 13:23:53 +0000 (15:23 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 28 Aug 2024 13:23:53 +0000 (15:23 +0200)
app/Models/ToolWebflow.php
app/Services/Webflow.php
app/SubForms/Webflow/SEOPage.php

index 909539d4cac6e056961c4487f68e0fd062ae0ed7..613ef425f8bdd4d54f42e50a9203d98ab409456c 100644 (file)
@@ -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) {
index 0d2e08e6fb6add78e320b4f7776c0ca729232249..439e3793c3b62f51ea8d7cd3e27e54caf28991e7 100644 (file)
@@ -288,10 +288,8 @@ class Webflow
                     }
                 }
 
-
                 $url = '/' . $url;
 
-
                 $seo = [
                     'id' => $pageID,
                     'url' => $url,
@@ -317,6 +315,7 @@ class Webflow
                         $html = str_replace('<br>', "\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);
                     }
                 }
             }
index fa6f36bd9e88c2e03ed276031356d7ff9041cb87..67ecfd527d4ac8d2cf7ca7b59ff1f7e0a287270a 100644 (file)
@@ -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']]]);