-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eba392d
commit 767d78b
Showing
4 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
## jmodule_get_module($name, $title = null) | ||
|
||
Get a module published on the current page by its name or folder. | ||
|
||
1. [Parameters](#parameters) | ||
1. [Returns](#returns) | ||
2. [Examples](#examples) | ||
|
||
### Parameters <a id="parameters"></a> | ||
|
||
* `string` **$name** Name of the module (real, eg 'Breadcrumbs' or folder, eg 'mod_breadcrumbs') | ||
* `array` **$title** [optional] Title of the module. | ||
|
||
### Returns <a id="returns"></a> | ||
|
||
`\stdClass|null` - The first module found that matches the name if found. Empty object if module not found and name starts with `mod_`. Null otherwise. | ||
|
||
### Examples <a id="examples"></a> | ||
|
||
```twig | ||
{% raw %} | ||
{# Retrieve a `mod_menu` module #} | ||
{% set module = jmodule_get_module('mod_menu') %} | ||
{# Retrieve a `mod_menu` module by its name (name is the module element removing the mod_ part). #} | ||
{% set module = jmodule_get_module('menu') %} | ||
{# Retrieve a `mod_menu` module with a specific title. #} | ||
{% set module = jmodule_get_module('mod_menu', 'Main Menu') %} | ||
{% endraw %} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
## jmodule_get_modules($position) | ||
|
||
Gets modules assigned to a specific position. | ||
|
||
1. [Parameters](#parameters) | ||
1. [Returns](#returns) | ||
2. [Examples](#examples) | ||
|
||
### Parameters <a id="parameters"></a> | ||
|
||
* `string` **$position** Name of the position | ||
|
||
### Returns <a id="returns"></a> | ||
|
||
`array` An array containing modules of that position. Empty array if no modules were found. | ||
|
||
### Examples <a id="examples"></a> | ||
|
||
```twig | ||
{% raw %} | ||
{# Retrieve modules available in a `sidebar` position #} | ||
{% set modules = jmodule_get_modules('sidebar') %} | ||
{% for module in modules %} | ||
<pre>Found module: {{ module.name }} with title: {{ module.title }}</pre> | ||
{% endfor %} | ||
{% endraw %} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
## jmodule_render_module($module, $attribs = array()) | ||
|
||
Render a module object. | ||
|
||
1. [Parameters](#parameters) | ||
1. [Returns](#returns) | ||
2. [Examples](#examples) | ||
|
||
### Parameters <a id="parameters"></a> | ||
|
||
* `object` **$module** Object containing module information | ||
* `array` **$attribs** [optional] Array of attributes for the module (probably from the XML). | ||
|
||
### Returns <a id="returns"></a> | ||
|
||
`\string` Rendered module. | ||
|
||
### Examples <a id="examples"></a> | ||
|
||
```twig | ||
{% raw %} | ||
{# Retrieve and display all the modules in a sidebar position #} | ||
{% for module in jmodule_get_modules('sidebar') %} | ||
{{ jmodule_render_module(module) }} | ||
{% endfor %} | ||
{% endraw %} | ||
``` |