Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #6053 from DeoJr/patch-1
Browse files Browse the repository at this point in the history
Updated view-models.md
  • Loading branch information
dobooth authored Nov 22, 2019
2 parents 74b2aa5 + 3d6746c commit c6d9c27
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions guides/v2.2/extension-dev-guide/view-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ The following example shows how to add functionality to a core template with cus
```xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.cart.item.renderers.default">
<arguments>
<argument name="view_model" xsi:type="object">Vendor\CustomModule\ViewModel\MyClass</argument>
</arguments>
</referenceBlock>
</body>
<body>
<referenceBlock name="checkout.cart.item.renderers.default">
<arguments>
<argument name="view_model" xsi:type="object">Vendor\CustomModule\ViewModel\MyClass</argument>
</arguments>
</referenceBlock>
</body>
</page>
```

You must implement the right interface in your `view_model` class (for example `ArgumentInterface`):
Expand Down

0 comments on commit c6d9c27

Please sign in to comment.