Skip to content

Instantly share code, notes, and snippets.

@philwinkle
Last active December 28, 2015 01:09
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save philwinkle/7418219 to your computer and use it in GitHub Desktop.
[Quickcast] Creating a new module in Magento2 A 3-part quickcast series demonstrating how to create a new module in Magento2, how to utilize the new Interception functionality, and how to chain multiple plugins targeting the same functionality together.
<?xml version="1.0"?>
<config>
<type name="Magento\Backend\Model\Menu\Item">
<plugin name="myname2" type="Philwinkle\Module2\Model\Plugin" sortOrder="100"/>
</type>
</config>
<?xml version="1.0"?>
<config>
<module name="Philwinkle_Module2" version="0.0.1.0" active="true"></module>
</config>
<?php
namespace Philwinkle\Module2\Model;
class Plugin
{
public function afterGetTitle($value)
{
return '==' . $value . '==';
}
}
<?xml version="1.0"?>
<config>
<type name="Magento\Backend\Model\Menu\Item">
<plugin name="myname" type="Philwinkle\Module\Model\Plugin" sortOrder="50"/>
</type>
</config>
<?xml version="1.0"?>
<config>
<module name="Philwinkle_Module" version="0.0.1.0" active="true"></module>
</config>
<?php
namespace Philwinkle\Module\Model;
class Plugin
{
public function afterGetTitle($value)
{
return '(' . $value . ')';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment