module_params
Summary
Extracts parameters from the module that was run.
Usage
module_params()
Returns
An array containing module information.
Description
This operator extracts some generic information from the module that was run. It seems that it can only be called inside "pagelayout.tpl". Please refer to the example below. The operator does not take any parameters.
Examples
Example 1
{module_params()|attribute(show)}If the requested URL is "/content/view/full/65" (or using URL alias that points to "/content/view/full/65"), the following output will be produced:
| Attribute | Type | Value |
|---|---|---|
| module_name | string | 'content' |
| function_name | string | 'view' |
| parameters | array | Array(2) |
| -ViewMode | string | 'full' |
| -NodeID | string | 65 |
Please note that this operator can only be called in "pagelayout.tpl".
Contributors
- Balazs Halasy Updated
- Kjartan Commenter
Comments (2 historical)
Written by readers of the earlier documentation sites, kept as they were.
Writing out a single value
Kjartan ·
I`d like to write out the NodeID by itself, but can`t seem to find a way to do this. While the following outputs the function_name value:
{module_params.function_name}
This for some reason fails to do the same for the NodeID:
{module_params.>NodeID}
Is there some other way I should do this, or might this feature be disabled for some good reason? Any help is appreciated.
Re: Writing out a single value
Kjartan ·
Found the answer to this slightly silly question: Apparently >NodeID and >ViewMode are elements in the array 'parameters', so the two values are accessible by using eg:
{module_params()[parameters][NodeID]}
Hope this saves somebody else a little pointless frustration.