-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 84183b8
Showing
8 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
namespace Orangecat\TemplateSymlinks\Plugin; | ||
|
||
class DirectoryValidator | ||
{ | ||
public function afterIsValid(\Magento\Framework\Filesystem\Directory\PathValidator $subject, $result) | ||
{ | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
namespace Orangecat\TemplateSymlinks\Plugin; | ||
|
||
class FileValidator | ||
{ | ||
public function aroundIsValid(\Magento\Framework\View\Element\Template\File\Validator $subject, $proceed, $filename) | ||
{ | ||
return $proceed($filename) || file_exists($filename); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# M2 Template Link | ||
|
||
Magento does not allow symlinks to templates (.phtml) that are outside of the Magento filesystem. This module allows modifying this characteristic. | ||
|
||
This module will allow us to keep the code under development isolated from the Magento installation. | ||
|
||
It is especially useful when you need to test a module in different Magento versions. | ||
|
||
This module should only be used for development purposes as it violates some security measures to fulfill its purpose. | ||
|
||
This module has been developed for Magento +2.3.x | ||
|
||
## Installation | ||
|
||
The extension can be installed via `composer`. To proceed, run these commands in your terminal: | ||
|
||
``` | ||
cd /to/root/magento/install | ||
composer require orangecat/templatesymlinks | ||
php bin/magento module:enable Orangecat_TemplateSymlinks | ||
php bin/magento setup:upgrade | ||
``` | ||
If you need to use it in production mode, these commands will also be necessary: | ||
``` | ||
php bin/magento setup:di:compile | ||
php bin/magento setup:static-content:deploy | ||
``` | ||
|
||
## Note | ||
You must first enable symlinks by going to Admin > Stores > Configuration > Advanced > Developer > Template Settings and setting the Allow Symlinks option to Yes. | ||
|
||
## Symlink | ||
Example of how to create a Symlink | ||
|
||
ln -s /path/to/your/module/under/development/directory/Vendor/YorModuleName YorModuleName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "orangecat/templatesymlinks", | ||
"description": "Allows reaching templates with Symlinks", | ||
"require": { | ||
"php": "~7.1.3||~7.2.0||~7.3.0" | ||
}, | ||
"type": "magento2-module", | ||
"version": "1.0.0", | ||
"authors": [ | ||
{ | ||
"name": "Oliverio Gombert", | ||
"email": "olivertar@gmail.com", | ||
"homepage": "http://olivert.com.ar", | ||
"role": "Developer" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"Orangecat\\TemplateSymlinks\\": "" | ||
}, | ||
"files": [ | ||
"registration.php" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> | ||
<type name="Magento\Framework\Filesystem\Directory\PathValidator"> | ||
<plugin name="orangecat_templatesymlink_view_element_template_directory_validator" type="Orangecat\TemplateSymlinks\Plugin\DirectoryValidator" sortOrder="10" disabled="false"/> | ||
</type> | ||
<type name="Magento\Framework\View\Element\Template\File\Validator"> | ||
<plugin name="orangecat_templatesymlink_view_element_template_file_validator" type="Orangecat\TemplateSymlinks\Plugin\FileValidator" sortOrder="10" disabled="false"/> | ||
</type> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> | ||
<module name="Orangecat_TemplateSymlinks"/> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
\Magento\Framework\Component\ComponentRegistrar::register( | ||
\Magento\Framework\Component\ComponentRegistrar::MODULE, | ||
'Orangecat_TemplateSymlinks', | ||
__DIR__ | ||
); |