di.xml 指定或重写Proxy
config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
preference for="MagentoContactControllerIndexPost" type="InfinityContactControllerIndexPost" />
config>
ps: 重写 block 时如涉及读取组件模板,可能也需要把 phtml 复制到当前 module 中
di.xml 指定或重写某个类中构造函数入参所依赖Proxy
xml version="1.0"?>
config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
type name="[Vendor][Module]Xxx">
arguments>
argument name="arg1" xsi:type="object">[Vendor][Module]XxxxxProxyargument>
arguments>
type>
config>
di.xml 声明plugin,用于修改目标类若干个method的入参或者返回结果
xml version="1.0"?>
config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
type name="MagentoCustomerModelResourceVisitor">
plugin name="catalogLog"
type="MagentoCatalogModelPluginLog"
sortOrder="1"
disabled="true" />
type>
config>
http://devdocs.magento.com/gu…
layout
page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
body>
referenceBlock name="page.main.title">
action method="setPageTitle">
argument translate="true" name="title" xsi:type="string">Page Titleargument>
action>
referenceBlock>
container name="div.sidebar.additional" htmlTag="div" htmlClass="sidebar sidebar-additional" after="div.sidebar.main">
container name="sidebar.additional" as="sidebar_additional" label="Sidebar Additional"/>
container>
referenceContainer name="sidebar.additional">
block class="MagentoFrameworkViewElementTemplate" name="catalog.compare.sidebar"
template="Magento_Catalog::product/compare/sidebar.phtml">
action method="setText">
argument name="text" translate="true" xsi:type="string">Textargument>
action>
arguments>
argument name="cache_lifetime" xsi:type="number">84600argument>
arguments>
block>
referenceBlock name="catalog.compare.sidebar" remove="true" />
move element="name.of.an.element" destination="name.of.destination.element" as="new_alias" after="name.of.element.after" before="name.of.element.before"/>
referenceContainer>
body>
page>
webapi.xml 声明webapi
routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
route url="/V1/customerGroups/:id" method="GET">
service class="MagentoCustomerApiGroupRepositoryInterface" method="getById"/>
resources>
resource ref="Magento_Customer::group"/>
resources>
route>
routes>
events.xml
config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
event name="controller_action_predispatch">
observer name="infinity_autocoupon_controller_action_predispatch" instance="InfinityAutoCouponObserverPredispatch" />
event>
config>