Skip to content

Commit 06d3b14

Browse files
committed
Merge branch 'develop' into feature/CON-226
2 parents 22381c2 + 88e95c9 commit 06d3b14

File tree

6 files changed

+68
-7
lines changed

6 files changed

+68
-7
lines changed

Api/Data/SiteInterface.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ interface SiteInterface extends ExtensibleDataInterface
1515
const SITE_ID = 'site_id';
1616
const API_USERNAME = 'api_username';
1717
const API_PASSWORD = 'api_password';
18+
const REPLACE_MEDIA_URLS = 'replace_media_urls';
1819
const ENABLE_BLOG = 'enable_blog';
1920
const BLOG_PREFIX = 'blog_prefix';
2021
const BLOG_STORES = 'blog_stores';
@@ -110,6 +111,19 @@ public function getApiPassword(): ?string;
110111
*/
111112
public function setApiPassword(?string $apiPassword);
112113

114+
/**
115+
* Get replace_media_urls
116+
* @return bool
117+
*/
118+
public function getReplaceMediaUrls(): ?bool;
119+
120+
/**
121+
* Set replace_media_urls
122+
* @param bool $replaceMediaUrls
123+
* @return SiteInterface
124+
*/
125+
public function setReplaceMediaUrls(?bool $replaceMediaUrls);
126+
113127
/**
114128
* Get enable_blog
115129
* @return bool

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Added
9+
- Added site settings to enable the media URL replace option
810

911
## [0.3.0] - 2021-02-10
1012
### Added

Model/Data/Site.php

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,25 @@ public function setApiPassword(?string $apiPassword)
143143
return $this->setData(self::API_PASSWORD, $apiPassword);
144144
}
145145

146+
/**
147+
* Get replace_media_urls
148+
* @return bool|null
149+
*/
150+
public function getReplaceMediaUrls(): bool
151+
{
152+
return (bool) $this->_get(self::REPLACE_MEDIA_URLS);
153+
}
154+
155+
/**
156+
* Set replace_media_urls
157+
* @param bool $replaceMediaUrls
158+
* @return SiteInterface
159+
*/
160+
public function setReplaceMediaUrls($replaceMediaUrls)
161+
{
162+
return $this->setData(self::REPLACE_MEDIA_URLS, $replaceMediaUrls);
163+
}
164+
146165
/**
147166
* Get enable_blog
148167
* @return bool|null
@@ -162,13 +181,6 @@ public function setEnableBlog($enableBlog)
162181
return $this->setData(self::ENABLE_BLOG, $enableBlog);
163182
}
164183

165-
/**
166-
* - Add data rentation for route prefix + store views
167-
* - Add check at cronjob per site to check which blog is enabled
168-
* - Add check at cronjob for all stores to see which is applicable
169-
* - Create rewrite URLs
170-
*/
171-
172184
/**
173185
* Get blog_prefix
174186
* @return string

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ Base module for Magento 2 Wordpress Integration, currently only used for module
1414
composer require mooore/magento2-module-wordpress-integration
1515
bin/magento setup:upgrade
1616
```
17+
18+
### Use magento store as image URLs
19+
20+
Create a symlink from your CMS environment's `wp-content` folder to `pub/media/wp-content` , and enable the "Replace Media URLs" option in a Site Config

etc/db_schema.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<column default="1" name="enabled" nullable="false" xsi:type="boolean"/>
1414
<column length="255" name="api_username" nullable="true" xsi:type="varchar"/>
1515
<column length="255" name="api_password" nullable="true" xsi:type="varchar"/>
16+
<column default="0" name="replace_media_urls" nullable="false" xsi:type="boolean"/>
1617
<column default="0" name="enable_blog" nullable="false" xsi:type="boolean"/>
1718
<column length="255" name="blog_prefix" nullable="true" xsi:type="varchar"/>
1819
<column length="255" name="blog_stores" nullable="false" xsi:type="varchar"/>

view/adminhtml/ui_component/mooore_wordpressintegration_site_form.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,34 @@
102102
</validation>
103103
</settings>
104104
</field>
105+
<field formElement="checkbox" name="replace_media_urls" sortOrder="50">
106+
<argument name="data" xsi:type="array">
107+
<item name="config" xsi:type="array">
108+
<item name="source" xsi:type="string">Site</item>
109+
<item name="default" xsi:type="number">0</item>
110+
</item>
111+
</argument>
112+
<settings>
113+
<dataType>boolean</dataType>
114+
<label translate="true">Replace Media URLs</label>
115+
<notice translate="true">Please only enable this when you are absolutely sure about what you are doing! This may cause images no longer to be rendered.</notice>
116+
<dataScope>replace_media_urls</dataScope>
117+
<validation>
118+
<rule name="required-entry" xsi:type="boolean">false</rule>
119+
</validation>
120+
</settings>
121+
<formElements>
122+
<checkbox>
123+
<settings>
124+
<valueMap>
125+
<map name="false" xsi:type="number">0</map>
126+
<map name="true" xsi:type="number">1</map>
127+
</valueMap>
128+
<prefer>toggle</prefer>
129+
</settings>
130+
</checkbox>
131+
</formElements>
132+
</field>
105133
<field formElement="checkbox" name="enabled" sortOrder="9">
106134
<argument name="data" xsi:type="array">
107135
<item name="config" xsi:type="array">

0 commit comments

Comments
 (0)