forked from getkirby-v2/modules-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
modules.php
31 lines (27 loc) · 938 Bytes
/
modules.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/**
* Kirby Modules Plugin
*
* @author Lukas Bestle <[email protected]>
*/
// Define autoloader
load(array(
'kirby\\modules\\modules' => __DIR__ . DS . 'lib' . DS . 'modules.php',
'kirby\\modules\\module' => __DIR__ . DS . 'lib' . DS . 'module.php',
'kirby\\modules\\modulepage' => __DIR__ . DS . 'lib' . DS . 'modulepage.php',
));
// Register page methods, blueprints and page models
Kirby\Modules\Modules::register();
/**
* Helper function to output modules for a given page
* You can also use $page->modules($data, $return)
*
* @param Page $page Kirby page that contains modules
* @param array $data Optional additional data to pass to each module
* @param boolean $return Whether to output or return the module string
* @return string
*/
function modules($page, $data = array(), $return = false) {
$modules = new Kirby\Modules\Modules($page);
return $modules->output($data, $return);
}