Skip to content

Commit f75417c

Browse files
committed
Add manual for overriding component's layouts
1 parent 29f9923 commit f75417c

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,24 @@ This provides several key benefits:
5656
- **Customizable Rendering**: Users can override default component templates via theme partials.
5757
- **Layout Selection**: Components support multiple layout options, allowing greater flexibility in presentation.
5858

59-
To override a component’s layout, create a folder inside your theme's partials directory matching the component's alias
60-
(e.g., `/themes/custom/partials/mycomponent`) and add layout files like `default.htm`, `special.htm`, etc.
59+
#### Overriding a Component’s Layout
60+
61+
To override a component’s layout, follow these steps:
62+
63+
1. Create a folder inside your theme's `partials` directory that matches the component's alias
64+
(e.g., `/themes/custom/partials/mycomponent`) and add layout files such as `default.htm`, `special.htm`, etc.
65+
2. In your custom plugin's `Plugin.php` file, enable layout overrides in the `boot()` method by setting the
66+
static property `$overrideLayout` to `true`. Example:
67+
68+
```php
69+
class Plugin extends PluginBase
70+
{
71+
public function boot()
72+
{
73+
\NumenCode\Widgets\Components\Promotions::$overrideLayout = true;
74+
}
75+
}
76+
```
6177

6278
---
6379

0 commit comments

Comments
 (0)