Skip to content

Instantly share code, notes, and snippets.

@xcommerce-gists
Last active January 4, 2016 01:29
Show Gist options
  • Save xcommerce-gists/8548728 to your computer and use it in GitHub Desktop.
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
<?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