Skip to content

Commit

Permalink
Merge pull request #69 from mooore-digital/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
GrimLink authored Jan 24, 2022
2 parents c7c1cbd + 524fa66 commit 59ebb7f
Show file tree
Hide file tree
Showing 16 changed files with 248 additions and 177 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.8.8] - 2022-01-24
### Added
- noindex and nocookie pages now support WPCI pages and style

### Fixed
- Cleanup code by improving formatting

## [0.8.7] - 2022-01-11
### Fixed
- Resolved wrongly fixed merge conflict
Expand Down
14 changes: 13 additions & 1 deletion Observer/LayoutLoadBefore.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Mooore\WordpressIntegrationCms\Observer;

use Magento\Cms\Model\Page;
Expand All @@ -12,6 +14,16 @@

class LayoutLoadBefore implements ObserverInterface
{
// TODO: check if contact_index_index is used with CMS pages, if so, add the following code
const DISALLOWED_PAGES = [
'cms_page_view',
'cms_index_index',
];

const ALLOWED_PAGES = [
'cms_index_noroute',
'cms_index_nocookies',
];
/**
* @var Http
*/
Expand Down Expand Up @@ -40,7 +52,7 @@ public function execute(Observer $observer)
{
$action = $observer->getData('full_action_name');

if ($action !== 'cms_page_view' && $action !== 'cms_index_index') {
if (!in_array($action, self::DISALLOWED_PAGES) && in_array($action, self::ALLOWED_PAGES)) {
return;
}

Expand Down
26 changes: 18 additions & 8 deletions etc/adminhtml/di.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<config
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Cms\Model\PageRepository">
<plugin sortOrder="1" name="moooreWordpressIntegrationCmsPostUrlToWordpress"
type="Mooore\WordpressIntegrationCms\Plugin\Model\SavePlugin"/>
<plugin
sortOrder="1"
name="moooreWordpressIntegrationCmsPostUrlToWordpress"
type="Mooore\WordpressIntegrationCms\Plugin\Model\SavePlugin"
/>
</type>
<type name="Magento\Cms\Controller\Adminhtml\Page\Delete">
<plugin sortOrder="1" name="moooreWordpressIntegrationCmsDeleteUrlToWordpress"
type="Mooore\WordpressIntegrationCms\Plugin\Controller\Adminhtml\Page\DeletePlugin"/>
<plugin
sortOrder="1"
name="moooreWordpressIntegrationCmsDeleteUrlToWordpress"
type="Mooore\WordpressIntegrationCms\Plugin\Controller\Adminhtml\Page\DeletePlugin"
/>
</type>
<type name="Magento\Cms\Controller\Adminhtml\Page\MassDelete">
<plugin sortOrder="1" name="moooreWordpressIntegrationCmsMassDeleteUrlToWordpress"
type="Mooore\WordpressIntegrationCms\Plugin\Controller\Adminhtml\Page\MassDeletePlugin"/>
<plugin
sortOrder="1"
name="moooreWordpressIntegrationCmsMassDeleteUrlToWordpress"
type="Mooore\WordpressIntegrationCms\Plugin\Controller\Adminhtml\Page\MassDeletePlugin"
/>
</type>
</config>
11 changes: 7 additions & 4 deletions etc/adminhtml/events.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<config
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="cms_page_prepare_save">
<observer instance="Mooore\WordpressIntegrationCms\Observer\Adminhtml\PageDetacher"
name="mooore_pagedetacher"/>
<observer
instance="Mooore\WordpressIntegrationCms\Observer\Adminhtml\PageDetacher"
name="mooore_pagedetacher"
/>
</event>
</config>
49 changes: 27 additions & 22 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<?xml version="1.0"?>
<config
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="cms">
<group id="wordpress_integration"
translate="label"
sortOrder="100"
showInDefault="1"
showInWebsite="0"
showInStore="0">
<group
id="wordpress_integration"
translate="label"
sortOrder="100"
showInDefault="1"
showInWebsite="0"
showInStore="0">
<label>Wordpress Integration</label>
<field id="baseurls"
translate="label"
type="textarea"
showInDefault="1"
showInWebsite="0"
showInStore="0">
<field
id="baseurls"
translate="label"
type="textarea"
showInDefault="1"
showInWebsite="0"
showInStore="0">
<label>Base URLs</label>
</field>
<field id="magento_url_push_back"
type="select"
translate="label"
canRestore="1"
showInDefault="1"
showInWebsite="1"
showInStore="0"
sortOrder="0">
<field
id="magento_url_push_back"
type="select"
translate="label"
canRestore="1"
showInDefault="1"
showInWebsite="1"
showInStore="0"
sortOrder="0">
<label>Push Magento page-url back to Wordpress</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
Expand Down
5 changes: 3 additions & 2 deletions etc/config.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<config
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<cms>
<wordpress_integration>
Expand Down
15 changes: 11 additions & 4 deletions etc/db_schema.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
<?xml version="1.0" ?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<?xml version="1.0"?>
<schema
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="cms_page">
<column name="wordpress_page_id" comment="Wordpress Page Id" nullable="true" xsi:type="varchar" length="64"/>
<column
name="wordpress_page_id"
comment="Wordpress Page Id"
nullable="true"
xsi:type="varchar"
length="64"
/>
</table>
</schema>
12 changes: 8 additions & 4 deletions etc/frontend/di.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<config
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Cms\Model\Page">
<plugin sortOrder="1" name="moooreWordpressIntegrationCmsPage"
type="Mooore\WordpressIntegrationCms\Plugin\Model\PagePlugin"/>
<plugin
sortOrder="1"
name="moooreWordpressIntegrationCmsPage"
type="Mooore\WordpressIntegrationCms\Plugin\Model\PagePlugin"
/>
</type>
</config>
11 changes: 7 additions & 4 deletions etc/frontend/events.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<config
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="layout_load_before">
<observer instance="Mooore\WordpressIntegrationCms\Observer\LayoutLoadBefore"
name="mooore_wordpressintegrationcms"/>
<observer
instance="Mooore\WordpressIntegrationCms\Observer\LayoutLoadBefore"
name="mooore_wordpressintegrationcms"
/>
</event>
</config>
7 changes: 4 additions & 3 deletions etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<config
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Mooore_WordpressIntegrationCms" setup_version="1.0.0">
<sequence>
<module name="Magento_Cms"/>
<module name="Mooore_WordpressIntegration"/>
</sequence>
</module>
</config>
</config>
1 change: 1 addition & 0 deletions registration.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

use Magento\Framework\Component\ComponentRegistrar;
Expand Down
11 changes: 8 additions & 3 deletions view/adminhtml/ui_component/cms_page_form.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<form
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="general">
<field name="wordpress_page" component="Mooore_WordpressIntegrationCms/js/components/select-site" sortOrder="100" formElement="select">
<field
name="wordpress_page"
component="Mooore_WordpressIntegrationCms/js/components/select-site"
sortOrder="100"
formElement="select">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filterOptions" xsi:type="boolean">true</item>
Expand Down
13 changes: 6 additions & 7 deletions view/adminhtml/web/js/components/select-site.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
define([
'Magento_Ui/js/form/element/ui-select'
], function (Select) {
'use strict';
define(["Magento_Ui/js/form/element/ui-select"], function (Select) {
"use strict";
return Select.extend({
/**
* Parse data and set it to options.
Expand All @@ -16,8 +14,9 @@ define([
}
this.options([]);
this.setOption(option);
this.set('newOption', option);
this.set("newOption", option);
},

/**
* Normalize option object.
*
Expand All @@ -27,8 +26,8 @@ define([
parseData: function (data) {
return {
value: data.customer.entity_id,
label: data.customer.name
label: data.customer.name,
};
}
},
});
});
Loading

0 comments on commit 59ebb7f

Please sign in to comment.