Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reinsert SEO fields in Blog Post Edit Form #370

Open
wants to merge 1 commit into
base: 2.4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion Block/Adminhtml/Post/Edit/Tab/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'),
]);
}

Expand Down
4 changes: 4 additions & 0 deletions etc/db_schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
<column xsi:type="varchar" name="url_key" nullable="true" length="255" comment="Post URL Key"/>
<column xsi:type="int" name="in_rss" padding="11" unsigned="false" nullable="true" identity="false" comment="Post In RSS"/>
<column xsi:type="int" name="allow_comment" padding="11" unsigned="false" nullable="true" identity="false" comment="Post Allow Comment"/>
<column xsi:type="varchar" name="meta_title" nullable="true" length="255" comment="Meta Title"/>
<column xsi:type="mediumtext" name="meta_keywords" nullable="true" comment="Meta Keywords"/>
<column xsi:type="mediumtext" name="meta_description" nullable="true" comment="Meta Description"/>
<column xsi:type="mediumtext" name="meta_robots" nullable="true" comment="Post Meta Robots"/>
<column xsi:type="timestamp" name="updated_at" on_update="false" nullable="true"/>
<column xsi:type="timestamp" name="created_at" on_update="false" nullable="true"/>
<column xsi:type="int" name="author_id" padding="10" unsigned="true" nullable="true" identity="false" comment="Author ID"/>
Expand Down