Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#32055] Add advanced parameters to module chromes #3760

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 13 additions & 7 deletions administrator/templates/isis/html/modules.php
Expand Up @@ -47,17 +47,23 @@ function modChrome_well($module, &$params, &$attribs)
{
if ($module->content)
{
$moduleTag = $params->get('module_tag', 'div');
$bootstrapSize = (int) $params->get('bootstrap_size');
$moduleClass = ($bootstrapSize) ? ' span' . $bootstrapSize : '';
$headerTag = htmlspecialchars($params->get('header_tag', 'h2'));

echo '<div class="well well-small' . $moduleClass . '">';
// Temporarily store header class in variable
$headerClass = $params->get('header_class');
$headerClass = ($headerClass) ? ' ' . htmlspecialchars($headerClass) : '';

if ($module->showtitle)
{
echo '<h2 class="module-title nav-header">' . $module->title . '</h2>';
}
echo '<' . $moduleTag . ' class="well well-small' . $moduleClass . '">';

echo $module->content;
echo '</div>';
if ($module->showtitle)
{
echo '<' . $headerTag . ' class="module-title nav-header' . $headerClass . '">' . $module->title . '</' . $headerTag . '>';
}

echo $module->content;
echo '</' . $moduleTag . '>';
}
}
23 changes: 17 additions & 6 deletions administrator/templates/system/html/modules.php
Expand Up @@ -18,7 +18,7 @@ function modChrome_none($module, &$params, &$attribs)
}

/*
* html5 (chosen html5 tag and font headder tags)
* html5 (chosen html5 tag and font header tags)
*/
function modChrome_html5($module, &$params, &$attribs)
{
Expand Down Expand Up @@ -47,17 +47,28 @@ function modChrome_html5($module, &$params, &$attribs)

/*
* xhtml (divs and font header tags)
* With the new advanced parameter it does the same as the html5 chrome
*/
function modChrome_xhtml($module, &$params, &$attribs)
{
$moduleTag = $params->get('module_tag', 'div');
$headerTag = htmlspecialchars($params->get('header_tag', 'h3'));
$bootstrapSize = (int) $params->get('bootstrap_size', 0);
$moduleClass = $bootstrapSize != 0 ? ' span' . $bootstrapSize : '';

// Temporarily store header class in variable
$headerClass = $params->get('header_class');
$headerClass = ($headerClass) ? ' class="' . htmlspecialchars($headerClass) . '"' : '';

$content = trim($module->content);

if (!empty ($content)) : ?>
<div class="module<?php echo htmlspecialchars($params->get('moduleclass_sfx')); ?>">
<?php if ($module->showtitle != 0) : ?>
<h3><?php echo $module->title; ?></h3>
<?php endif; ?>
<<?php echo $moduleTag; ?> class="module<?php echo htmlspecialchars($params->get('moduleclass_sfx')) . $moduleClass; ?>">
<?php if ($module->showtitle != 0) : ?>
<<?php echo $headerTag . $headerClass . '>' . $module->title; ?></<?php echo $headerTag; ?>>
<?php endif; ?>
<?php echo $content; ?>
</div>
</<?php echo $moduleTag; ?>>
<?php endif;
}

Expand Down
22 changes: 15 additions & 7 deletions templates/protostar/html/modules.php
Expand Up @@ -36,15 +36,23 @@ function modChrome_no($module, &$params, &$attribs)

function modChrome_well($module, &$params, &$attribs)
{
$moduleTag = $params->get('module_tag', 'div');
$bootstrapSize = (int) $params->get('bootstrap_size', 0);
$moduleClass = $bootstrapSize != 0 ? ' span' . $bootstrapSize : '';
$headerTag = htmlspecialchars($params->get('header_tag', 'h3'));
$headerClass = htmlspecialchars($params->get('header_class', 'page-header'));

if ($module->content)
{
echo "<div class=\"well " . htmlspecialchars($params->get('moduleclass_sfx')) . "\">";
if ($module->showtitle)
{
echo "<h3 class=\"page-header\">" . $module->title . "</h3>";
}
echo $module->content;
echo "</div>";
echo '<' . $moduleTag . ' class="well ' . htmlspecialchars($params->get('moduleclass_sfx')) . $moduleClass . '">';

if ($module->showtitle)
{
echo '<' . $headerTag . ' class="' . $headerClass . '">' . $module->title . '</' . $headerTag . '>';
}

echo $module->content;
echo '</' . $moduleTag . '>';
}
}
?>
28 changes: 19 additions & 9 deletions templates/system/html/modules.php
Expand Up @@ -18,7 +18,7 @@ function modChrome_none($module, &$params, &$attribs)
}

/*
* html5 (chosen html5 tag and font headder tags)
* html5 (chosen html5 tag and font header tags)
*/
function modChrome_html5($module, &$params, &$attribs)
{
Expand All @@ -28,8 +28,8 @@ function modChrome_html5($module, &$params, &$attribs)
$moduleClass = $bootstrapSize != 0 ? ' span' . $bootstrapSize : '';

// Temporarily store header class in variable
$headerClass = $params->get('header_class');
$headerClass = !empty($headerClass) ? ' class="' . htmlspecialchars($headerClass) . '"' : '';
$headerClass = $params->get('header_class');
$headerClass = !empty($headerClass) ? ' class="' . htmlspecialchars($headerClass) . '"' : '';

if (!empty ($module->content)) : ?>
<<?php echo $moduleTag; ?> class="moduletable<?php echo htmlspecialchars($params->get('moduleclass_sfx')) . $moduleClass; ?>">
Expand Down Expand Up @@ -83,17 +83,27 @@ function modChrome_horz($module, &$params, &$attribs)
}

/*
* xhtml (divs and font headder tags)
* xhtml (divs and font header tags)
* With the new advanced parameter it does the same as the html5 chrome
*/
function modChrome_xhtml($module, &$params, &$attribs)
{
$moduleTag = $params->get('module_tag', 'div');
$headerTag = htmlspecialchars($params->get('header_tag', 'h3'));
$bootstrapSize = (int) $params->get('bootstrap_size', 0);
$moduleClass = $bootstrapSize != 0 ? ' span' . $bootstrapSize : '';

// Temporarily store header class in variable
$headerClass = $params->get('header_class');
$headerClass = ($headerClass) ? ' class="' . htmlspecialchars($headerClass) . '"' : '';

if (!empty ($module->content)) : ?>
<div class="moduletable<?php echo htmlspecialchars($params->get('moduleclass_sfx')); ?>">
<?php if ((bool) $module->showtitle) : ?>
<h3><?php echo $module->title; ?></h3>
<?php endif; ?>
<<?php echo $moduleTag; ?> class="moduletable<?php echo htmlspecialchars($params->get('moduleclass_sfx')) . $moduleClass; ?>">
<?php if ((bool) $module->showtitle) : ?>
<<?php echo $headerTag . $headerClass . '>' . $module->title; ?></<?php echo $headerTag; ?>>
<?php endif; ?>
<?php echo $module->content; ?>
</div>
</<?php echo $moduleTag; ?>>
<?php endif;
}

Expand Down