Skip to content

Commit 485c067

Browse files
author
Korshenko, Olexii(okorshenko)
committed
Merge pull request #402 from magento-api/MAGETWO-36002-Responsive-Email-Template-PR
[API] Responsive Email Template - Merging outsourced PR 5
2 parents 7edd8d0 + 632227b commit 485c067

File tree

69 files changed

+3396
-1411
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+3396
-1411
lines changed

.travis.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ env:
99
- TEST_SUITE=integration_integrity
1010
- TEST_SUITE=static_phpcs
1111
- TEST_SUITE=static_annotation
12+
cache:
13+
apt: true
14+
directories:
15+
- $HOME/.composer/cache
16+
- $HOME/.cache/bin
1217
matrix:
1318
exclude:
1419
- php: 5.6
@@ -18,6 +23,16 @@ matrix:
1823
before_install:
1924
- sudo apt-get update -qq
2025
- sudo apt-get install -y -qq postfix
26+
- sh -c 'if [ "$CASHER_DIR" ]; then
27+
if [ -x $HOME/.cache/bin/composer ]; then
28+
$HOME/.cache/bin/composer self-update; echo '';
29+
else
30+
mkdir -p $HOME/.cache/bin;
31+
curl --connect-timeout 30 -sS https://getcomposer.org/installer \
32+
| php -- --install-dir $HOME/.cache/bin/ --filename composer;
33+
fi
34+
fi'
35+
- export PATH="$HOME/.cache/bin:$PATH"
2136
before_script:
2237
# Mock mail
2338
- sudo service postfix stop
@@ -46,7 +61,7 @@ before_script:
4661
# Change memory_limit for travis
4762
- echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
4863
- phpenv rehash;
49-
- composer install --no-interaction --dev
64+
- composer install --no-interaction --prefer-dist
5065
script:
5166
# Unit tests
5267
- sh -c "if [ '$TEST_SUITE' = 'unit' ]; then ./vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist; fi"
@@ -59,4 +74,4 @@ script:
5974
# Static tests [Code Style]
6075
- sh -c "if [ '$TEST_SUITE' = 'static_phpcs' ]; then cd dev/tests/static; ./../../../vendor/bin/phpunit -c phpunit.xml.dist --filter 'Magento\\\\Test\\\\Php\\\\LiveCodeTest::testCodeStyle'; fi"
6176
# Static tests [Code Style]
62-
- sh -c "if [ '$TEST_SUITE' = 'static_annotation' ]; then cd dev/tests/static; ./../../../vendor/bin/phpunit -c phpunit.xml.dist --filter 'Magento\\\\Test\\\\Php\\\\LiveCodeTest::testAnnotationStandard'; fi"
77+
- sh -c "if [ '$TEST_SUITE' = 'static_annotation' ]; then cd dev/tests/static; ./../../../vendor/bin/phpunit -c phpunit.xml.dist --filter 'Magento\\\\Test\\\\Php\\\\LiveCodeTest::testAnnotationStandard'; fi"

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,6 @@
137137
<comment>Alternative text for next link in pagination menu. If empty, default arrow image will used.</comment>
138138
</field>
139139
</group>
140-
<group id="email" translate="label" type="text" sortOrder="510" showInDefault="1" showInWebsite="1" showInStore="1">
141-
<label>Transactional Emails</label>
142-
<field id="logo" translate="label" type="image" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
143-
<label>Logo Image</label>
144-
<comment>Allowed file types: jpg, jpeg, gif, png</comment>
145-
<backend_model>Magento\Config\Model\Config\Backend\Email\Logo</backend_model>
146-
<base_url type="media" scope_info="1">email/logo</base_url>
147-
</field>
148-
<field id="logo_alt" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
149-
<label>Logo Image Alt</label>
150-
</field>
151-
</group>
152140
</section>
153141
<section id="dev" translate="label" type="text" sortOrder="920" showInDefault="1" showInWebsite="1" showInStore="1">
154142
<label>Developer</label>
@@ -287,6 +275,9 @@
287275
<field id="phone" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
288276
<label>Store Phone Number</label>
289277
</field>
278+
<field id="hours" translate="label" type="text" sortOrder="22" showInDefault="1" showInWebsite="1" showInStore="1">
279+
<label>Store Hours of Operation</label>
280+
</field>
290281
<field id="country_id" translate="label" type="select" sortOrder="25" showInDefault="1" showInWebsite="1" showInStore="0">
291282
<label>Country</label>
292283
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>

app/code/Magento/Catalog/Model/Template/Filter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function setUseSessionInUrl($flag)
9393
*/
9494
public function viewDirective($construction)
9595
{
96-
$params = $this->_getIncludeParameters($construction[2]);
96+
$params = $this->_getParameters($construction[2]);
9797
$params['_absolute'] = $this->_useAbsoluteLinks;
9898
/**
9999
* @bug: the "_absolute" key is not supported by underlying services
@@ -122,7 +122,7 @@ public function viewDirective($construction)
122122
*/
123123
public function mediaDirective($construction)
124124
{
125-
$params = $this->_getIncludeParameters($construction[2]);
125+
$params = $this->_getParameters($construction[2]);
126126
return $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . $params['url'];
127127
}
128128

@@ -136,7 +136,7 @@ public function mediaDirective($construction)
136136
*/
137137
public function storeDirective($construction)
138138
{
139-
$params = $this->_getIncludeParameters($construction[2]);
139+
$params = $this->_getParameters($construction[2]);
140140
if (!isset($params['_query'])) {
141141
$params['_query'] = [];
142142
}

app/code/Magento/Cms/Model/Template/Filter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function setUseSessionInUrl($flag)
3737
*/
3838
public function mediaDirective($construction)
3939
{
40-
$params = $this->_getIncludeParameters($construction[2]);
40+
$params = $this->_getParameters($construction[2]);
4141
return $this->_storeManager->getStore()->getBaseMediaDir() . '/' . $params['url'];
4242
}
4343
}

app/code/Magento/Email/Block/Adminhtml/Template/Preview.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,16 @@ public function __construct(
4747
*/
4848
protected function _toHtml()
4949
{
50+
$storeId = $this->getAnyStoreView()->getId();
51+
5052
/** @var $template \Magento\Email\Model\Template */
5153
$template = $this->_emailFactory->create(
52-
['data' => ['area' => \Magento\Framework\App\Area::AREA_FRONTEND]]
54+
['data' => [
55+
'area' => \Magento\Framework\App\Area::AREA_FRONTEND,
56+
'store' => $storeId
57+
]]
5358
);
54-
$id = (int)$this->getRequest()->getParam('id');
59+
$id = (int) $this->getRequest()->getParam('id');
5560
if ($id) {
5661
$template->load($id);
5762
} else {
@@ -63,14 +68,13 @@ protected function _toHtml()
6368
$template->setTemplateText($this->_maliciousCode->filter($template->getTemplateText()));
6469

6570
\Magento\Framework\Profiler::start("email_template_proccessing");
66-
$vars = [];
6771

68-
$store = $this->getAnyStoreView();
69-
$storeId = $store ? $store->getId() : null;
70-
$template->setDesignConfig(
71-
['area' => $this->_design->getArea(), 'store' => $storeId]
72+
$template->emulateDesign($storeId);
73+
$templateProcessed = $this->_appState->emulateAreaCode(
74+
\Magento\Email\Model\AbstractTemplate::DEFAULT_DESIGN_AREA,
75+
[$template, 'getProcessedTemplate']
7276
);
73-
$templateProcessed = $template->getProcessedTemplate($vars, true);
77+
$template->revertDesign();
7478

7579
if ($template->isPlain()) {
7680
$templateProcessed = "<pre>" . htmlspecialchars($templateProcessed) . "</pre>";

0 commit comments

Comments
 (0)