From 86a56f5e747394f8dd8952dea623096b31ac94d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Fernandes?= Date: Wed, 10 Jul 2024 14:53:12 -0300 Subject: [PATCH] Reinsert SEO fields in Bblog Post Edit Form - The structure maintains logic to map specific SEO to blog posts but the fields were not present in the db_schema or in the admin form --- Block/Adminhtml/Post/Edit/Tab/Post.php | 33 +++++++++++++++++++++++++- etc/db_schema.xml | 4 ++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Block/Adminhtml/Post/Edit/Tab/Post.php b/Block/Adminhtml/Post/Edit/Tab/Post.php index 221fd8f4..bc782d2a 100755 --- a/Block/Adminhtml/Post/Edit/Tab/Post.php +++ b/Block/Adminhtml/Post/Edit/Tab/Post.php @@ -303,6 +303,33 @@ protected function _prepareForm() ); $this->_eventManager->dispatch('after_adminhtml_blog_post_info_tab', ['fieldset' => $fieldset]); + $seoFieldset = $form->addFieldset('seo_fieldset', [ + 'legend' => __('Search Engine Optimization'), + 'class' => 'fieldset-wide' + ]); + + $seoFieldset->addField('meta_title', 'text', [ + 'name' => 'meta_title', + 'label' => __('Meta Title'), + 'title' => __('Meta Title') + ]); + $seoFieldset->addField('meta_description', 'textarea', [ + 'name' => 'meta_description', + 'label' => __('Meta Description'), + 'title' => __('Meta Description') + ]); + $seoFieldset->addField('meta_keywords', 'textarea', [ + 'name' => 'meta_keywords', + 'label' => __('Meta Keywords'), + 'title' => __('Meta Keywords') + ]); + $seoFieldset->addField('meta_robots', 'select', [ + 'name' => 'meta_robots', + 'label' => __('Meta Robots'), + 'title' => __('Meta Robots'), + 'values' => $this->metaRobotsOptions->toOptionArray() + ]); + $designFieldset = $form->addFieldset('design_fieldset', [ 'legend' => __('Design'), 'class' => 'fieldset-wide' @@ -317,7 +344,11 @@ protected function _prepareForm() if (!$post->getId()) { $post->addData([ - 'allow_comment' => 1 + 'allow_comment' => 1, + 'meta_title' => $this->_scopeConfig->getValue('blog/seo/meta_title'), + 'meta_description' => $this->_scopeConfig->getValue('blog/seo/meta_description'), + 'meta_keywords' => $this->_scopeConfig->getValue('blog/seo/meta_keywords'), + 'meta_robots' => $this->_scopeConfig->getValue('blog/seo/meta_robots'), ]); } diff --git a/etc/db_schema.xml b/etc/db_schema.xml index f89fd399..cf124629 100644 --- a/etc/db_schema.xml +++ b/etc/db_schema.xml @@ -12,6 +12,10 @@ + + + +