forked from deved-it/magento2-disable-customer-registration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRegistrationPlugin.php
33 lines (27 loc) · 873 Bytes
/
RegistrationPlugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/**
* Copyright (c) 2016 Salvatore Guarino. All rights reserved.
*/
namespace Deved\DisableRegistration\Plugin;
use Magento\Customer\Model\Registration;
class RegistrationPlugin
{
/**
* @var \Magento\Framework\App\Config\ScopeConfigInterface
*/
protected $scopeConfig;
const XML_PATH_DISABLE_CUSTOMER_REGISTRATION = 'customer/create_account/disable_customer_registration';
public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig)
{
$this->scopeConfig = $scopeConfig;
}
public function afterIsAllowed(Registration $subject)
{
$storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
if ($this->scopeConfig->getValue(self::XML_PATH_DISABLE_CUSTOMER_REGISTRATION, $storeScope))
{
return false;
}
return true;
}
}