You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 25, 2021. It is now read-only.
Besides the main `$page->modules()` method that is used to output the module snippets, there are also a few other helper methods you can use:
137
+
138
+
### `$page->moduleList()`
139
+
140
+
Returns an array of the module pages for the given page.
141
+
142
+
### `$page->moduleCount($type)`
143
+
144
+
Returns the number of modules. If `$type` is given, returns the number of modules of that type.
145
+
146
+
### `$page->hasModules($type)`
147
+
148
+
Returns whether the page has any modules. If `$type` is given, returns whether the page has modules of that type.
149
+
150
+
### `$module->page()`
151
+
152
+
Returns the page where the module appears. Depending on your setup, it's either the parent page or the grandparent page.
153
+
154
+
### `$module->module()`
155
+
156
+
Returns the module object. You can use it to get more information about the module:
157
+
158
+
```
159
+
var_dump($module->module()->name()); // Name of the module
160
+
var_dump($module->module()->template()); // Template name of the module
161
+
```
162
+
163
+
There are also a few other values of the module object, see `lib/module.php`.
164
+
134
165
## Using together with the Patterns plugin
135
166
136
167
Since the plugin only requires the modules to have a snippet and a blueprint, modules can be stored inside the `site/patterns` directory if you use the [Patterns plugin](https://github.com/getkirby-plugins/patterns-plugin). This is useful if you want to present the different modules in the Patterns interface.
0 commit comments