MDL-74251 core: Remove old icon helper classes

This commit is contained in:
Adrian Perez 2024-05-22 16:41:17 +02:00 committed by Luca Bösch
parent 5aef789ac6
commit e1353c7649
37 changed files with 61 additions and 53 deletions

View File

@ -0,0 +1,7 @@
issueNumber: MDL-74251
notes:
theme:
- message: >-
Removed all references to iconhelp, icon-pre, icon-post, iconlarge, and
iconsort classes
type: removed

View File

@ -1004,7 +1004,7 @@ class core_admin_renderer extends plugin_renderer_base {
function upgrade_reload($url) {
return html_writer::empty_tag('br') .
html_writer::tag('div',
html_writer::link($url, $this->pix_icon('i/reload', '', '', array('class' => 'icon icon-pre')) .
html_writer::link($url, $this->pix_icon('i/reload', '', '', ['class' => 'icon']) .
get_string('reload'), array('title' => get_string('reload'))),
array('class' => 'continuebutton')) . html_writer::empty_tag('br');
}

View File

@ -69,7 +69,7 @@
"url": "http://example.org/help",
"linktext": "",
"icon": {
"extraclasses": "iconhelp",
"extraclasses": "",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}
@ -87,7 +87,7 @@
"url": "http://example.org/help",
"linktext": "",
"icon": {
"extraclasses": "iconhelp",
"extraclasses": "",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}
@ -103,7 +103,7 @@
"url": "http://example.org/help",
"linktext": "",
"icon": {
"extraclasses": "iconhelp",
"extraclasses": "",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}
@ -119,7 +119,7 @@
"url": "http://example.org/help",
"linktext": "",
"icon": {
"extraclasses": "iconhelp",
"extraclasses": "",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}

View File

@ -277,7 +277,7 @@ abstract class backup_activity_task extends backup_task {
$settingname = $settingprefix . 'included';
$activityincluded = new backup_activity_generic_setting($settingname, base_setting::IS_BOOLEAN, true);
$activityincluded->get_ui()->set_icon(new image_icon('monologo', get_string('pluginname', $this->modulename),
$this->modulename, array('class' => 'iconlarge icon-post ml-1')));
$this->modulename, array('class' => 'ml-1')));
$this->add_setting($activityincluded);
// Look for "activities" root setting.
$activities = $this->plan->get_setting('activities');

View File

@ -301,7 +301,7 @@ abstract class restore_activity_task extends restore_task {
$settingname = $settingprefix . 'included';
$activity_included = new restore_activity_generic_setting($settingname, base_setting::IS_BOOLEAN, true);
$activity_included->get_ui()->set_icon(new image_icon('monologo', get_string('pluginname', $this->modulename),
$this->modulename, array('class' => 'iconlarge icon-post ml-1')));
$this->modulename, ['class' => 'ml-1']));
$this->add_setting($activity_included);
// Look for "activities" root setting
$activities = $this->plan->get_setting('activities');

View File

@ -203,7 +203,7 @@ class core_backup_renderer extends plugin_renderer_base {
$table->data = array();
}
$name = get_string('pluginname', $activity->modulename);
$icon = new image_icon('monologo', '', $activity->modulename, ['class' => 'iconlarge icon-pre']);
$icon = new image_icon('monologo', '', $activity->modulename);
$table->data[] = array(
$this->output->render($icon).$name,
$activity->title,

View File

@ -783,13 +783,13 @@ class core_badges_renderer extends plugin_renderer_base {
$url = new moodle_url($this->page->url);
$url->params(array('sort' => $sortid, 'dir' => 'ASC'));
$out .= $this->output->action_icon($url,
new pix_icon('t/sort_asc', get_string('sortbyx', 'core', s($text)), null, array('class' => 'iconsort')));
new pix_icon('t/sort_asc', get_string('sortbyx', 'core', s($text)), null));
}
if ($sortby !== $sortid || $sorthow !== 'DESC') {
$url = new moodle_url($this->page->url);
$url->params(array('sort' => $sortid, 'dir' => 'DESC'));
$out .= $this->output->action_icon($url,
new pix_icon('t/sort_desc', get_string('sortbyxreverse', 'core', s($text)), null, array('class' => 'iconsort')));
new pix_icon('t/sort_desc', get_string('sortbyxreverse', 'core', s($text)), null));
}
}
return $out;

View File

@ -48,7 +48,7 @@
"url": "http://example.org/help",
"linktext": "",
"icon":{
"extraclasses": "iconhelp",
"extraclasses": "",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}

View File

@ -47,7 +47,7 @@
"url": "http://example.org/help",
"linktext": "",
"icon":{
"extraclasses": "iconhelp",
"extraclasses": "",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}

View File

@ -549,7 +549,7 @@ M.course_dndupload = {
resel.div.appendChild(resel.a);
resel.icon.src = M.util.image_url('i/ajaxloader');
resel.icon.className = 'activityicon iconlarge';
resel.icon.className = 'activityicon';
resel.a.appendChild(resel.icon);
resel.namespan.className = 'instancename';

View File

@ -378,8 +378,8 @@ class core_course_renderer extends plugin_renderer_base {
}
$altname = get_accesshide(' ' . $cm->modfullname);
$name = html_writer::empty_tag('img', array('src' => $cm->get_icon_url(),
'class' => 'iconlarge activityicon', 'alt' => '')) .
$name = html_writer::empty_tag('img', ['src' => $cm->get_icon_url(),
'class' => 'activityicon', 'alt' => '']) .
html_writer::tag('span', ' '.$cm->get_formatted_name() . $altname, array('class' => 'instancename'));
$formattedinfo = \core_availability\info::format_info($cm->availableinfo, $cm->get_course());
return html_writer::div($name, 'activityinstance-error') .

View File

@ -42,7 +42,7 @@
<input type="checkbox" id="selectactivity_{{cmid}}" class="mr-1" name="cmid[]" data-section="{{sectionnumber}}" value="{{cmid}}" aria-label="{{#str}}checkactivity, completion, {{{modname}}}{{/str}}">
{{/canmanage}}
<a href="{{url}}">
<img src="{{icon}}" class="iconlarge activityicon" alt="">
<img src="{{icon}}" class="activityicon" alt="">
<span class="instancename">{{{modname}}}</span>
</a>
</div>

View File

@ -68,7 +68,7 @@
{{#pix}} t/expandedchevron, core {{/pix}}
<span class="sr-only">{{#str}} collapsecategory, core, {{formatedname}} {{/str}}</span>
</span>
<img class="iconlarge activityicon ml-4" src="{{icon}}" alt="" aria-hidden="true">
<img class="activityicon ml-4" src="{{icon}}" alt="" aria-hidden="true">
<h2 class="activityname ml-3 mb-0">{{{formattedname}}}</h2>
</a>
</div>

View File

@ -302,7 +302,7 @@ Feature: Display and choose from the available activities in course
# Confirm more help link exists
Then "More help" "link" should exist
# Confirm that corresponding help icon exist
And ".iconhelp" "css_element" should exist
And ".fa-info-circle" "css_element" should exist
# Confirm that link opens in new window
And "Opens in new window" "link" should be visible
# Confirm the same behaviour for weekly format course
@ -313,6 +313,6 @@ Feature: Display and choose from the available activities in course
# Confirm more help link exists
And "More help" "link" should exist
# Confirm that corresponding help icon exist
And ".iconhelp" "css_element" should exist
And ".fa-info-circle" "css_element" should exist
# Confirm that link opens in new window
And "Opens in new window" "link" should be visible

View File

@ -1878,7 +1878,7 @@ class core_renderer extends renderer_base {
public function doc_link($path, $text = '', $forcepopup = false, array $attributes = []) {
global $CFG;
$icon = $this->pix_icon('book', '', 'moodle', ['class' => 'iconhelp icon-pre']);
$icon = $this->pix_icon('book', '', 'moodle');
$attributes['href'] = new moodle_url(get_docs_url($path));
$newwindowicon = '';
@ -2079,7 +2079,7 @@ class core_renderer extends renderer_base {
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, ['class' => 'icon iconlarge']);
$image = $this->pix_icon($icon, $iconalt, $component);
}
$help = '';
@ -2146,7 +2146,7 @@ class core_renderer extends renderer_base {
$title = get_string('helpprefix2', '', $scale->name) . ' (' . get_string('newwindow') . ')';
$icon = $this->pix_icon('help', get_string('scales'), 'moodle', ['class' => 'iconhelp']);
$icon = $this->pix_icon('help', get_string('scales'), 'moodle');
$scaleid = abs($scale->id);
@ -2521,7 +2521,7 @@ EOD;
if (empty($message)) {
return '';
}
$message = $this->pix_icon('i/warning', get_string('error'), '', ['class' => 'icon icon-pre', 'title' => '']) . $message;
$message = $this->pix_icon('i/warning', get_string('error'), '', ['class' => 'icon', 'title' => '']) . $message;
return html_writer::tag('span', $message, ['class' => 'error']);
}

View File

@ -100,7 +100,7 @@ class help_icon implements renderable, templatable {
$data = get_formatted_help_string($this->identifier, $this->component, false, $this->a);
$data->alt = $alt;
$data->icon = (new pix_icon('help', $alt, 'core', ['class' => 'iconhelp']))->export_for_template($output);
$data->icon = (new pix_icon('help', $alt, 'core'))->export_for_template($output);
$data->linktext = $this->linktext;
$data->title = get_string('helpprefix2', '', trim($title, ". \t"));

View File

@ -162,7 +162,7 @@ function install_helpbutton($url, $title='') {
echo "<a href=\"javascript:void(0)\" ";
echo "onclick=\"return window.open('$url','Help','menubar=0,location=0,scrollbars,resizable,width=500,height=400')\"";
echo ">";
echo "<img src=\"pix/help.gif\" class=\"iconhelp\" alt=\"$title\" title=\"$title\"/>";
echo "<img src=\"pix/help.gif\" alt=\"$title\" title=\"$title\"/>";
echo "</a>\n";
}

View File

@ -42,7 +42,7 @@
"url": "http://example.org/help",
"linktext": "",
"icon":{
"extraclasses": "iconhelp",
"extraclasses": "",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}

View File

@ -10,7 +10,7 @@
"linktext": "",
"icon":{
"attributes": [
{"name": "class", "value": "iconhelp"},
{"name": "class", "value": ""},
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}
]

View File

@ -48,7 +48,7 @@
"name": "Second option",
"description": "Second option description",
"icon": {
"extraclasses": "iconhelp",
"extraclasses": "",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}
@ -64,7 +64,7 @@
"name": "Third option",
"description": "Third option description",
"icon": {
"extraclasses": "iconhelp",
"extraclasses": "",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}

View File

@ -36,7 +36,7 @@
"name": "Second option",
"description": "Second option description",
"icon": {
"extraclasses": "iconhelp",
"extraclasses": "",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}

View File

@ -51,7 +51,7 @@
"name": "Second option",
"description": "Second option description",
"icon": {
"extraclasses": "iconhelp",
"extraclasses": "",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}
@ -67,7 +67,7 @@
"name": "Third option",
"description": "Third option description",
"icon": {
"extraclasses": "iconhelp",
"extraclasses": "",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}

View File

@ -56,7 +56,7 @@
"attributes": [
{
"name": "class",
"value": "iconhelp"
"value": ""
},
{
"name": "alt",

View File

@ -14,7 +14,7 @@
"url": "http://example.org/help",
"linktext": "",
"icon":{
"extraclasses": "iconhelp",
"extraclasses": "",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}

View File

@ -39,7 +39,7 @@
"url": "http://example.org/help",
"linktext": "",
"icon": {
"extraclasses": "iconhelp",
"extraclasses": "",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}

View File

@ -48,7 +48,7 @@
"linktext": "",
"icon":{
"attributes": [
{"name": "class", "value": "iconhelp"},
{"name": "class", "value": ""},
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}
]
@ -76,7 +76,7 @@
"linktext": "",
"icon":{
"attributes": [
{"name": "class", "value": "iconhelp"},
{"name": "class", "value": ""},
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}
]
@ -104,7 +104,7 @@
"linktext": "",
"icon":{
"attributes": [
{"name": "class", "value": "iconhelp"},
{"name": "class", "value": ""},
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}
]
@ -132,7 +132,7 @@
"linktext": "",
"icon":{
"attributes": [
{"name": "class", "value": "iconhelp"},
{"name": "class", "value": ""},
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}
]

View File

@ -57,7 +57,7 @@
"url": "http://example.org/help",
"linktext": "",
"icon":{
"extraclasses": "iconhelp",
"extraclasses": "",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}

View File

@ -75,7 +75,7 @@
"url": "http://example.org/help",
"linktext": "",
"icon":{
"extraclasses": "iconhelp",
"extraclasses": "",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}

View File

@ -43,7 +43,7 @@
"url": "http://example.org/help",
"linktext": "",
"icon":{
"extraclasses": "iconhelp",
"extraclasses": "",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}

View File

@ -39,7 +39,7 @@
"url": "http://example.org/help",
"linktext": "",
"icon":{
"extraclasses": "iconhelp",
"extraclasses": "",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}

View File

@ -38,7 +38,7 @@
"url": "http://example.org/help",
"linktext": "",
"icon":{
"extraclasses": "iconhelp",
"extraclasses": "",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}

View File

@ -804,7 +804,7 @@ class renderer extends plugin_renderer_base {
if ($attemptobj->is_question_flagged($slot)) {
// Quiz has custom JS manipulating these image tags - so we can't use the pix_icon method here.
$flag = html_writer::empty_tag('img', ['src' => $this->image_url('i/flagged'),
'alt' => get_string('flagged', 'question'), 'class' => 'questionflag icon-post']);
'alt' => get_string('flagged', 'question'), 'class' => 'questionflag']);
}
if ($attemptobj->can_navigate_to($slot)) {
$row = [html_writer::link($attemptobj->attempt_url($slot),

View File

@ -39,7 +39,7 @@
"url": "http://example.org/help",
"linktext": "",
"icon": {
"extraclasses": "iconhelp",
"extraclasses": "",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}

View File

@ -1022,13 +1022,13 @@ class mod_workshop_renderer extends plugin_renderer_base {
$url = new moodle_url($this->page->url);
$url->params(array('sortby' => $sortid, 'sorthow' => 'ASC'));
$out .= $this->output->action_icon($url, new pix_icon('t/sort_asc', get_string('sortasc', 'workshop')),
null, array('class' => 'iconsort sort asc'));
null, ['class' => 'sort asc']);
}
if ($sortby !== $sortid or $sorthow !== 'DESC') {
$url = new moodle_url($this->page->url);
$url->params(array('sortby' => $sortid, 'sorthow' => 'DESC'));
$out .= $this->output->action_icon($url, new pix_icon('t/sort_desc', get_string('sortdesc', 'workshop')),
null, array('class' => 'iconsort sort desc'));
null, ['class' => 'sort desc']);
}
}
return $out;

View File

@ -221,16 +221,17 @@ abstract class column_base extends view_component {
}
/**
* Get an icon representing the corrent sort state.
* Get an icon representing the current sort state.
*
* @param bool $reverse sort is descending, not ascending.
* @return string HTML image tag.
*/
protected function get_sort_icon($reverse): string {
global $OUTPUT;
if ($reverse) {
return $OUTPUT->pix_icon('t/sort_desc', get_string('desc'), '', ['class' => 'iconsort']);
return $OUTPUT->pix_icon('t/sort_desc', get_string('desc'));
} else {
return $OUTPUT->pix_icon('t/sort_asc', get_string('asc'), '', ['class' => 'iconsort']);
return $OUTPUT->pix_icon('t/sort_asc', get_string('asc'));
}
}

View File

@ -33,7 +33,7 @@
Sortable column, with a single type of sort (e.g. question type)
* sortable: true
* sortlinks: HTML of the title, in a link to sort by this. E.g. "<a href=\"http:\/\/localhost\/moodle_head\/question\/edit.php?courseid=100000&amp;qbs1=-qbank_viewquestiontype%5Cquestion_type_column&amp;qbs2=qbank_viewquestionname%5Cquestion_name_idnumber_tags_column-name\" title=\"Sort by Question type descending\">\n T<i class=\"icon fa fa-sort-asc fa-fw iconsort\" title=\"Ascending\" role=\"img\" aria-label=\"Ascending\"><\/i>\n<\/a>"
* sortlinks: HTML of the title, in a link to sort by this. E.g. "<a href=\"http:\/\/localhost\/moodle_head\/question\/edit.php?courseid=100000&amp;qbs1=-qbank_viewquestiontype%5Cquestion_type_column&amp;qbs2=qbank_viewquestionname%5Cquestion_name_idnumber_tags_column-name\" title=\"Sort by Question type descending\">\n T<i class=\"icon fa fa-sort-asc fa-fw\" title=\"Ascending\" role=\"img\" aria-label=\"Ascending\"><\/i>\n<\/a>"
Sortable column, with an overall title, and multiple sort types (e.g. question name/idnumber)
* sortable: true

View File

@ -398,7 +398,7 @@ case 'plugins':
$aurl->params(array('savepath'=>$savepath, 'action' => 'list', 'repo_id' => $info->id, 'draftpath'=>$draftpath));
echo '<li>';
echo html_writer::empty_tag('img', array('src'=>$info->icon, 'alt'=>$info->name, 'class'=>'icon icon-pre'));
echo html_writer::empty_tag('img', ['src' => $info->icon, 'alt' => $info->name, 'class' => 'icon']);
echo html_writer::link($aurl, s($info->name));
echo '</li>';
}