Difference between revisions of "JModuleHelper/getModule"
From Joomla! Documentation
< API15:JModuleHelper
m (removing red link to edit, no existant pages) |
|||
Line 3: | Line 3: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Syntax=== | ===Syntax=== | ||
Line 75: | Line 75: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Examples=== | ===Examples=== | ||
Line 90: | Line 90: | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
+ | [[Category:Archived pages API15]] |
Revision as of 13:37, 12 May 2013
The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Get module by name (real, eg 'Breadcrumbs' or folder, eg 'mod_breadcrumbs')
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax[edit]
& getModule($name, $title=null)
Parameter Name | Default Value | Description |
---|---|---|
$name | $name The name of the module | |
$title | null | $title The title of the module, optional |
Returns[edit]
object The Module object
Defined in[edit]
libraries/joomla/application/module/helper.php
Importing[edit]
jimport( 'joomla.application.module.helper' );
Source Body[edit]
function &getModule($name, $title = null )
{
$result = null;
$modules =& JModuleHelper::_load();
$total = count($modules);
for ($i = 0; $i < $total; $i++)
{
// Match the name of the module
if ($modules[$i]->name == $name)
{
// Match the title if we're looking for a specific instance of the module
if ( ! $title || $modules[$i]->title == $title )
{
$result =& $modules[$i];
break; // Found it
}
}
}
// if we didn't find it, and the name is mod_something, create a dummy object
if (is_null( $result ) && substr( $name, 0, 4 ) == 'mod_')
{
$result = new stdClass;
$result->id = 0;
$result->title = '';
$result->module = $name;
$result->position = '';
$result->content = '';
$result->showtitle = 0;
$result->control = '';
$result->params = '';
$result->user = 0;
}
return $result;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples[edit]
<CodeExamplesForm />