PHP code example of creatuity / magento2-interceptors
1. Go to this page and download the library: Download creatuity/magento2-interceptors library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
creatuity / magento2-interceptors example snippets
public function methodX($arg) {
$pluginInfo = $this->pluginList->getNext($this->subjectType, 'methodX');
if (!$pluginInfo) {
return parent::methodX($arg);
} else {
return $this->___callPlugins('methodX', func_get_args(), $pluginInfo);
}
}
public function methodX($arg) {
switch(getCurrentScope()){
case 'frontend':
$this->_get_example_plugin()->beforeMethodX($this, $arg);
$this->_get_another_plugin()->beforeMethodX($this, $arg);
$result = $this->_get_around_plugin()->aroundMethodX($this, function($arg){
return parent::methodX($arg);
});
return $this->_get_after_plugin()->afterMethodX($this, $result);
case 'adminhtml':
// ...
default:
return parent::methodX($arg);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.