MDL-41438 core_renderer: Update the parameters for heading() and heading_with_help().
heading(), change the default value for classes from 'main' to null. heading_with_help(), add 2 additional parameters for level and classnames. Default value of level is set to 2 and classnames is set to null. With the changes for heading_with_help(), icon image vertical alignment needs to be adjusted, so it display in the middle of the heading. Also added some notes in theme/upgrade.txt file.
This commit is contained in:
@@ -2045,9 +2045,11 @@ class core_renderer extends renderer_base {
|
||||
* @param string $component component name
|
||||
* @param string|moodle_url $icon
|
||||
* @param string $iconalt icon alt text
|
||||
* @param int $level The level of importance of the heading. Defaulting to 2
|
||||
* @param string $classnames A space-separated list of CSS classes. Defaulting to null
|
||||
* @return string HTML fragment
|
||||
*/
|
||||
public function heading_with_help($text, $helpidentifier, $component = 'moodle', $icon = '', $iconalt = '') {
|
||||
public function heading_with_help($text, $helpidentifier, $component = 'moodle', $icon = '', $iconalt = '', $level = 2, $classnames = null) {
|
||||
$image = '';
|
||||
if ($icon) {
|
||||
$image = $this->pix_icon($icon, $iconalt, $component, array('class'=>'icon'));
|
||||
@@ -2058,7 +2060,7 @@ class core_renderer extends renderer_base {
|
||||
$help = $this->help_icon($helpidentifier, $component);
|
||||
}
|
||||
|
||||
return $this->heading($image.$text.$help, 2, 'main help');
|
||||
return $this->heading($image.$text.$help, $level, $classnames);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2669,11 +2671,11 @@ EOD;
|
||||
*
|
||||
* @param string $text The text of the heading
|
||||
* @param int $level The level of importance of the heading. Defaulting to 2
|
||||
* @param string $classes A space-separated list of CSS classes
|
||||
* @param string $classes A space-separated list of CSS classes. Defaulting to null
|
||||
* @param string $id An optional ID
|
||||
* @return string the HTML to output.
|
||||
*/
|
||||
public function heading($text, $level = 2, $classes = 'main', $id = null) {
|
||||
public function heading($text, $level = 2, $classes = null, $id = null) {
|
||||
$level = (integer) $level;
|
||||
if ($level < 1 or $level > 6) {
|
||||
throw new coding_exception('Heading level must be an integer between 1 and 6.');
|
||||
|
||||
@@ -97,10 +97,10 @@ img.resize {height: 1em;width: 1em;}
|
||||
.breadcrumb img.resize {height: 0.9em;width: 0.8em;}
|
||||
|
||||
/* Icon styles */
|
||||
img.icon {height:16px;vertical-align:text-bottom;width:16px;padding-right: 6px;}
|
||||
img.icon {height:16px;vertical-align:middle;width:16px;padding-right: 6px;}
|
||||
.dir-rtl img.icon {padding-left: 6px; padding-right: 0; }
|
||||
img.iconsmall {height:12px;margin-right:3px;vertical-align:middle;width:12px;}
|
||||
img.iconhelp, .helplink img {height:16px; padding-left:3px;vertical-align:text-bottom;width:16px;}
|
||||
img.iconhelp, .helplink img {height:16px; padding-left:3px;vertical-align:middle;width:16px;}
|
||||
.dir-rtl img.iconhelp, .dir-rtl .helplink img {padding-right: 3px; padding-left: 0; }
|
||||
img.iconlarge {height: 24px; width: 24px; vertical-align:middle;}
|
||||
img.iconsort { vertical-align: text-bottom; padding-left: .3em; margin-bottom: .15em;}
|
||||
|
||||
@@ -181,7 +181,7 @@ img.resize {
|
||||
/* Icon styles */
|
||||
img.icon {
|
||||
height: 16px;
|
||||
vertical-align: text-bottom;
|
||||
vertical-align: middle;
|
||||
width: 16px;
|
||||
padding-right: 6px;
|
||||
}
|
||||
@@ -198,7 +198,7 @@ img.iconsmall {
|
||||
img.iconhelp, .helplink img {
|
||||
height: 16px;
|
||||
padding-left: 3px;
|
||||
vertical-align: text-bottom;
|
||||
vertical-align: middle;
|
||||
width: 16px;
|
||||
}
|
||||
.dir-rtl img.iconhelp, .dir-rtl .helplink img {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,12 @@
|
||||
This files describes API changes in /theme/* themes,
|
||||
information provided here is intended especially for theme designer.
|
||||
=== 2.6 ===
|
||||
Notes:
|
||||
* The parameters value for the following functions have been modified: core_renderer::heading() and core_renderer::heading_with_help().
|
||||
In core_renderer::heading(), the third param value for classname is set to null as default.
|
||||
In core_renderer::heading_with_help(), additional parameters are added for heading level with default value set to 2,
|
||||
and classname with default value set to null.
|
||||
|
||||
=== 2.6 ===
|
||||
Notes:
|
||||
* The file picker and activity chooser have been converted to use M.core.dialogue. This means the styles
|
||||
|
||||
Reference in New Issue
Block a user