mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-36749 lib Complete deprecation of old_help_icon
This deprecates the old_help_icon and helpbutton functions. Since they can no longer be used, the renderers are removed altogether.
This commit is contained in:
parent
cce0d9a100
commit
a6d81a73ac
5 changed files with 9 additions and 237 deletions
|
@ -1518,8 +1518,6 @@ class core_renderer extends renderer_base {
|
|||
|
||||
if ($select->helpicon instanceof help_icon) {
|
||||
$output .= $this->render($select->helpicon);
|
||||
} else if ($select->helpicon instanceof old_help_icon) {
|
||||
$output .= $this->render($select->helpicon);
|
||||
}
|
||||
$output .= html_writer::select($select->options, $select->name, $select->selected, $select->nothing, $select->attributes);
|
||||
|
||||
|
@ -1609,8 +1607,6 @@ class core_renderer extends renderer_base {
|
|||
|
||||
if ($select->helpicon instanceof help_icon) {
|
||||
$output .= $this->render($select->helpicon);
|
||||
} else if ($select->helpicon instanceof old_help_icon) {
|
||||
$output .= $this->render($select->helpicon);
|
||||
}
|
||||
|
||||
// For security reasons, the script course/jumpto.php requires URL starting with '/'. To keep
|
||||
|
@ -1880,66 +1876,9 @@ class core_renderer extends renderer_base {
|
|||
* Returns HTML to display a help icon.
|
||||
*
|
||||
* @deprecated since Moodle 2.0
|
||||
* @param string $helpidentifier The keyword that defines a help page
|
||||
* @param string $title A descriptive text for accessibility only
|
||||
* @param string $component component name
|
||||
* @param string|bool $linktext true means use $title as link text, string means link text value
|
||||
* @return string HTML fragment
|
||||
*/
|
||||
public function old_help_icon($helpidentifier, $title, $component = 'moodle', $linktext = '') {
|
||||
debugging('The method old_help_icon() is deprecated, please fix the code and use help_icon() method instead', DEBUG_DEVELOPER);
|
||||
$icon = new old_help_icon($helpidentifier, $title, $component);
|
||||
if ($linktext === true) {
|
||||
$icon->linktext = $title;
|
||||
} else if (!empty($linktext)) {
|
||||
$icon->linktext = $linktext;
|
||||
}
|
||||
return $this->render($icon);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of user image rendering.
|
||||
*
|
||||
* @param old_help_icon $helpicon A help icon instance
|
||||
* @return string HTML fragment
|
||||
*/
|
||||
protected function render_old_help_icon(old_help_icon $helpicon) {
|
||||
global $CFG;
|
||||
|
||||
// first get the help image icon
|
||||
$src = $this->pix_url('help');
|
||||
|
||||
if (empty($helpicon->linktext)) {
|
||||
$alt = $helpicon->title;
|
||||
} else {
|
||||
$alt = get_string('helpwiththis');
|
||||
}
|
||||
|
||||
$attributes = array('src'=>$src, 'alt'=>$alt, 'class'=>'iconhelp');
|
||||
$output = html_writer::empty_tag('img', $attributes);
|
||||
|
||||
// add the link text if given
|
||||
if (!empty($helpicon->linktext)) {
|
||||
// the spacing has to be done through CSS
|
||||
$output .= $helpicon->linktext;
|
||||
}
|
||||
|
||||
// now create the link around it - we need https on loginhttps pages
|
||||
$url = new moodle_url($CFG->httpswwwroot.'/help.php', array('component' => $helpicon->component, 'identifier' => $helpicon->helpidentifier, 'lang'=>current_language()));
|
||||
|
||||
// note: this title is displayed only if JS is disabled, otherwise the link will have the new ajax tooltip
|
||||
$title = get_string('helpprefix2', '', trim($helpicon->title, ". \t"));
|
||||
|
||||
$attributes = array('href'=>$url, 'title'=>$title, 'aria-haspopup' => 'true');
|
||||
$id = html_writer::random_id('helpicon');
|
||||
$attributes['id'] = $id;
|
||||
$output = html_writer::tag('a', $output, $attributes);
|
||||
|
||||
$this->page->requires->js_init_call('M.util.help_icon.add', array(array('id'=>$id, 'url'=>$url->out(false))));
|
||||
$this->page->requires->string_for_js('close', 'form');
|
||||
|
||||
// and finally span
|
||||
return html_writer::tag('span', $output, array('class' => 'helptooltip'));
|
||||
throw new coding_exception('old_help_icon() can not be used any more, please see help_icon().');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue