Last active
January 4, 2016 01:29
-
-
Save xcommerce-gists/8548728 to your computer and use it in GitHub Desktop.
Portion of Magento IndexController.php that shows how to fire an event
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 | |
/** | |
* Lines 62 to 75 of IndexController.php that | |
* show how to fire an event | |
* | |
* Other code is removed for brevity | |
* | |
* @author Magento | |
*/ | |
//Starting at line 62 | |
Mage::dispatchEvent('before_news_item_display', array('news_item' => $model)); | |
$this->loadLayout(); | |
$itemBlock = $this->getLayout()->getBlock('news.item'); | |
if ($itemBlock) { | |
$listBlock = $this->getLayout()->getBlock('news.list'); | |
if ($listBlock) { | |
$page = (int)$listBlock->getCurrentPage() ? (int)$listBlock->getCurrentPage() : 1; | |
} else { | |
$page = 1; | |
} | |
$itemBlock->setPage($page); | |
} | |
$this->renderLayout(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment