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.');
|
||||
|
||||
Reference in New Issue
Block a user