From: Vincent Vanwaelscappel Date: Mon, 27 May 2024 15:04:53 +0000 (+0200) Subject: wip #6937 @1.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=5f876ea7e23b960b61c614278476c5f780d42519;p=fluidbook-toolbox.git wip #6937 @1.5 --- diff --git a/app/Models/ToolWebflow.php b/app/Models/ToolWebflow.php index a081b82e2..e63859a17 100644 --- a/app/Models/ToolWebflow.php +++ b/app/Models/ToolWebflow.php @@ -78,9 +78,18 @@ class ToolWebflow extends ToolboxModel public function onSaved(): bool { $this->onPublish('auto'); + $this->saveDataInWebflow(); return parent::onSaved(); } + protected function saveDataInWebflow(){ + // SEO + dddd($this->seo); + foreach ($this->seo as $item) { + + } + } + protected function refreshFormDataFromAPI() { $editable = Webflow::getEditableData($this->webflow); diff --git a/app/Services/Webflow.php b/app/Services/Webflow.php index 5c5a4d85c..e1d59ec76 100644 --- a/app/Services/Webflow.php +++ b/app/Services/Webflow.php @@ -242,6 +242,7 @@ class Webflow $seo = [ + 'id' => $pageID, 'url' => $url, 'type' => $type, 'slug' => $details['slug'], diff --git a/app/SubForms/Webflow/SEOPage.php b/app/SubForms/Webflow/SEOPage.php index 8e982c3d6..11f9d9929 100644 --- a/app/SubForms/Webflow/SEOPage.php +++ b/app/SubForms/Webflow/SEOPage.php @@ -4,7 +4,7 @@ namespace App\SubForms\Webflow; use Cubist\Backpack\Magic\Fields\Checkbox; use Cubist\Backpack\Magic\Fields\Hidden; -use Cubist\Backpack\Magic\Fields\StaticValue; +use Cubist\Backpack\Magic\Fields\HiddenVisible; use Cubist\Backpack\Magic\Fields\Text; use Cubist\Backpack\Magic\Fields\Textarea; use Cubist\Backpack\Magic\SubForm; @@ -15,15 +15,16 @@ class SEOPage extends SubForm { parent::init(); - $this->addField('url', Hidden::class, __('URL')); + $this->addField('id', HiddenVisible::class, __('#')); + $this->addField('url', HiddenVisible::class, __('URL')); $this->addField('type', Hidden::class, __('Type')); - $this->addField('slug', Text::class, __('Slug') . ' (' . __('slug') . ')', ['when' => ['url' => ['operator' => 'not', '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']]); $this->addField('og_title_copied', Checkbox::class, __('Utiliser le titre ci-dessus pour les réseaux sociaux'), ['when' => ['type' => 'page']]); - $this->addField('og_title', Text::class, __('Titre pour les réseaux sociaux'), ['when' => ['og_title_copied' => false, 'type' => 'page']]); - $this->addField('seo_description', Textarea::class, __('Description'), ['when' => ['type' => 'page']]); + $this->addField('og_title', Text::class, __('Titre pour les réseaux sociaux'), ['when' => ['og_title_copied' => '0', 'type' => 'page']]); + $this->addField('seo_description', Textarea::class, __('Description'), ['rows' => 2, 'when' => ['type' => 'page']]); $this->addField('og_description_copied', Checkbox::class, __('Utiliser la description ci-dessus pour les réseaux sociaux'), ['when' => ['type' => 'page']]); - $this->addField('og_description', Text::class, __('Description pour les réseaux sociaux'), ['when' => ['og_description_copied' => false, 'type' => 'page']]); + $this->addField('og_description', Textarea::class, __('Description pour les réseaux sociaux'), ['rows' => 2, 'when' => ['og_description_copied' => '0', 'type' => 'page']]); } }