Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to disable triggering controller action #125

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions app/code/core/Mage/Core/Block/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,19 @@ abstract class Mage_Core_Block_Abstract extends Varien_Object
*/
protected $_eventManager;


/**
* The prefix for the customized block events
* @var string
*/
protected $_eventPrefix;

/**
* The object for the customized block events
* @var string
*/
protected $_eventObject;

/**
* Class constructor
*
Expand Down Expand Up @@ -614,6 +627,10 @@ public function setFrameTags($openTag, $closeTag = null)
final public function toHtml()
{
Mage::dispatchEvent('core_block_abstract_to_html_before', array('block' => $this));
if ($this->_eventPrefix && $this->_eventObject) {
Mage::dispatchEvent($this->_eventPrefix . '_to_html_before', array($this->_eventObject => $this));
}

if (Mage::getStoreConfig('advanced/modules_disable_output/' . $this->getModuleName())) {
return '';
}
Expand Down
7 changes: 6 additions & 1 deletion app/code/core/Mage/Core/Controller/Varien/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ abstract class Mage_Core_Controller_Varien_Action implements Mage_Core_Controlle
{
const FLAG_NO_CHECK_INSTALLATION = 'no-install-check';
const FLAG_NO_DISPATCH = 'no-dispatch';
const FLAG_NO_DISPATCH_ACTION = 'no-dispatch-action';
const FLAG_NO_PRE_DISPATCH = 'no-preDispatch';
const FLAG_NO_POST_DISPATCH = 'no-postDispatch';
const FLAG_NO_START_SESSION = 'no-startSession';
Expand Down Expand Up @@ -469,7 +470,11 @@ public function dispatch($action)
*/
if (!$this->getFlag('', self::FLAG_NO_DISPATCH)) {
Magento_Profiler::start('action_body');
$this->$actionMethodName();

if (!$this->getFlag('', self::FLAG_NO_DISPATCH_ACTION)) {
$this->$actionMethodName();
}

Magento_Profiler::stop('action_body');

Magento_Profiler::start('postdispatch');
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Tax/Model/Calculation.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public function getRate($request)
$this->unsRateValue();
$this->unsCalculationProcess();
$this->unsEventModuleId();
Mage::dispatchEvent('tax_rate_data_fetch', array('request'=>$request));
Mage::dispatchEvent('tax_rate_data_fetch', array('request'=>$request, 'sender'=>$this));
if (!$this->hasRateValue()) {
$rateInfo = $this->_getResource()->getRateInfo($request);
$this->setCalculationProcess($rateInfo['process']);
Expand Down