Created
October 29, 2017 13:55
-
-
Save magevision/7b8980e6b637c6f02a272e84771a48d3 to your computer and use it in GitHub Desktop.
Blog Post 23
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
<?php | |
namespace MageVision\Blog23\Helper; | |
use Magento\Framework\App\Helper\AbstractHelper; | |
use Magento\Framework\Encryption\EncryptorInterface; | |
class Data extends AbstractHelper | |
{ | |
const XML_PATH_PASSWORD = 'blog/post23/password'; | |
/** | |
* @var EncryptorInterface | |
*/ | |
protected $encryptor; | |
/** | |
* @param EncryptorInterface $encryptor | |
*/ | |
public function __construct( | |
EncryptorInterface $encryptor | |
) { | |
$this->encryptor = $encryptor; | |
} | |
/** | |
* Get Password from config | |
* | |
* @return string | |
*/ | |
public function getPassword() | |
{ | |
$password = $this->scopeConfig->getValue(self::XML_PATH_PASSWORD, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); | |
return $this->encryptor->decrypt($password); | |
} | |
} |
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
<?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> | |
<tab id="magevision" translate="label" sortOrder="1000"> | |
<label>MageVision Blog Posts</label> | |
</tab> | |
<section id="blog" translate="label" type="text" sortOrder="1009" showInDefault="1" showInWebsite="1" showInStore="1"> | |
<label>Blog Post 23</label> | |
<tab>magevision</tab> | |
<resource>MageVision_Blog23::blog23_configuration</resource> | |
<group id="post23" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> | |
<label>General</label> | |
<field id="password" translate="label" sortOrder="10" type="obscure" showInDefault="1" showInWebsite="1" showInStore="1"> | |
<label>Password</label> | |
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> | |
</field> | |
</group> | |
</section> | |
</system> | |
</config> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment