-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Adding a Menu Item in the Admin
- Loading branch information
Showing
3 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
app/code/local/MasteringMagento/Example/controllers/Adminhtml/ExampleController.php
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
/** | ||
* app/code/local/MasteringMagento/Example/controllers/Adminhtml/ExampleController.php | ||
* | ||
* This example code is provided for use with the Mastering Magento video | ||
* series, by Packt Publishing. | ||
* | ||
* @author Franklin P. Strube <franklin.strube@gmail.com> | ||
* @category MasteringMagento | ||
* @package Example | ||
* @copyright Copyright (c) 2012 Packt Publishing (http://packtpub.com) | ||
*/ | ||
class MasteringMagento_Example_Adminhtml_ExampleController extends Mage_Adminhtml_Controller_Action | ||
{ | ||
public function indexAction() | ||
{ | ||
$this->loadLayout(); | ||
|
||
return $this->renderLayout(); | ||
} | ||
} | ||
|
||
?> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE config> | ||
<!-- | ||
/** | ||
* app/code/local/MasteringMagento/Example/etc/adminhtml.xml | ||
* | ||
* This example code is provided for use with the Mastering Magento video | ||
* series, by Packt Publishing. | ||
* | ||
* @author Franklin P. Strube <franklin.strube@gmail.com> | ||
* @category MasteringMagento | ||
* @package Example | ||
* @copyright Copyright (c) 2012 Packt Publishing (http://packtpub.com) | ||
*/ | ||
--> | ||
<config> | ||
<menu> | ||
<example translate="title" module="example"> | ||
<title>Example</title> | ||
<sort_order>1000</sort_order> | ||
<action>adminhtml/example</action> | ||
</example> | ||
</menu> | ||
</config> |
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
77fe60a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3.10 Recap: Adding a Menu Item in the Admin
Menu Configuration
Add your menu configuration to
app/code/local/MasteringMagento/Example/etc/adminhtml.xml
.Admin Controller
In your module configuraiton, tap into the existing admin frontname:
Create an admin controller in
app/code/local/MasteringMagento/Example/controllers/Adminhtml/ExampleController.php
. Admin controllers must extendMage_Adminhtml_Controller_Action
.