Skip to content

Commit

Permalink
MDL-40759 plugins: Add font icon mapping to all plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Damyon Wiese committed Mar 17, 2017
1 parent e6bf10c commit 2b93145
Show file tree
Hide file tree
Showing 19 changed files with 164 additions and 5 deletions.
9 changes: 9 additions & 0 deletions admin/tool/lp/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,12 @@ function tool_lp_coursemodule_edit_post_actions($data, $course) {

return $data;
}

/**
* Map icons for font-awesome themes.
*/
function tool_lp_get_fontawesome_icon_map() {
return [
'tool_lp:url' => 'fa-external-link'
];
}
9 changes: 9 additions & 0 deletions admin/tool/recyclebin/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,12 @@ function tool_recyclebin_pre_course_category_delete($category) {
$categorybin = new \tool_recyclebin\category_bin($category->id);
$categorybin->delete_all_items();
}

/**
* Map icons for font-awesome themes.
*/
function tool_recyclebin_get_fontawesome_icon_map() {
return [
'tool_recyclebin:trash' => 'fa-trash'
];
}
11 changes: 11 additions & 0 deletions admin/tool/usertours/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,14 @@ function tool_usertours_extend_navigation_user() {
function tool_usertours_before_footer() {
\tool_usertours\helper::bootstrap();
}

/**
* Map icons for font-awesome themes.
*/
function tool_usertours_get_fontawesome_icon_map() {
return [
'tool_usertours:t/export' => 'fa-download',
'tool_usertours:i/reload' => 'fa-refresh',
'tool_usertours:filler' => 'fa-spacer',
];
}
10 changes: 10 additions & 0 deletions enrol/guest/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -480,3 +480,13 @@ public function edit_instance_validation($data, $files, $instance, $context) {


}

/**
* Get icon mapping for font-awesome.
*/
function enrol_guest_get_fontawesome_icon_map() {
return [
'enrol_guest:withpassword' => 'fa-key',
'enrol_guest:withoutpassword' => 'fa-unlock-alt',
];
}
1 change: 1 addition & 0 deletions enrol/manual/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -730,3 +730,4 @@ public function edit_instance_validation($data, $files, $instance, $context) {
}

}

10 changes: 10 additions & 0 deletions enrol/self/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1053,3 +1053,13 @@ public function get_welcome_email_contact($sendoption, $context) {
return $contact;
}
}

/**
* Get icon mapping for font-awesome.
*/
function enrol_self_get_fontawesome_icon_map() {
return [
'enrol_self:withkey' => 'fa-key',
'enrol_self:withoutkey' => 'fa-unlock-alt',
];
}
3 changes: 3 additions & 0 deletions lib/editor/atto/plugins/collapse/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ function atto_collapse_params_for_js($elementid, $options, $fpoptions) {
return $params;
}

/**
* Map icons for font-awesome themes.
*/
function atto_collapse_get_fontawesome_icon_map() {
return [
'atto_collapse:icon' => 'fa-level-down'
Expand Down
16 changes: 16 additions & 0 deletions mod/book/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -670,3 +670,19 @@ function book_check_updates_since(cm_info $cm, $from, $filter = array()) {

return $updates;
}

/**
* Get icon mapping for font-awesome.
*/
function mod_book_get_fontawesome_icon_map() {
return [
'mod_book:chapter' => 'fa-bookmark-o',
'mod_book:nav_prev' => 'fa-arrow-left',
'mod_book:nav_prev_dis' => 'fa-angle-left',
'mod_book:nav-sep' => 'fa-minus',
'mod_book:add' => 'fa-plus',
'mod_book:nav_next' => 'fa-arrow-right',
'mod_book:nav_next_dis' => 'fa-angle-right',
'mod_book:nav_exit' => 'fa-arrow-up',
];
}
8 changes: 4 additions & 4 deletions mod/book/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
if ($book->navstyle == 1) {
$chnavigation .= '<a title="' . $navprevtitle . '" class="bookprev" href="view.php?id=' .
$cm->id . '&amp;chapterid=' . $previd . '">' .
'<img src="' . $OUTPUT->pix_url($navprevicon, 'mod_book') . '" class="icon" alt="' . $navprevtitle . '"/></a>';
$OUTPUT->pix_icon($navprevicon, $navprevtitle, 'mod_book') . '</a>';
} else {
$chnavigation .= '<a title="' . $navprev . '" class="bookprev" href="view.php?id=' .
$cm->id . '&amp;chapterid=' . $previd . '">' .
Expand All @@ -170,15 +170,15 @@
}
} else {
if ($book->navstyle == 1) {
$chnavigation .= '<img src="' . $OUTPUT->pix_url($navprevdisicon, 'mod_book') . '" class="icon" alt="" />';
$chnavigation .= $OUTPUT->pix_icon($navprevdisicon, '', 'mod_book');
}
}
if ($nextid) {
$navnext = get_string('navnext', 'book');
if ($book->navstyle == 1) {
$chnavigation .= '<a title="' . $navnexttitle . '" class="booknext" href="view.php?id=' .
$cm->id . '&amp;chapterid='.$nextid.'">' .
'<img src="' . $OUTPUT->pix_url($navnexticon, 'mod_book').'" class="icon" alt="' . $navnexttitle . '" /></a>';
$OUTPUT->pix_icon($navnexticon, $navnexttitle, 'mod_book') . '</a>';
} else {
$chnavigation .= ' <a title="' . $navnext . '" class="booknext" href="view.php?id=' .
$cm->id . '&amp;chapterid='.$nextid.'">' .
Expand All @@ -191,7 +191,7 @@
$returnurl = course_get_url($course, $sec);
if ($book->navstyle == 1) {
$chnavigation .= '<a title="' . $navexit . '" class="bookexit" href="'.$returnurl.'">' .
'<img src="' . $OUTPUT->pix_url('nav_exit', 'mod_book') . '" class="icon" alt="' . $navexit . '" /></a>';
$OUTPUT->pix_icon('nav_exit', $navexit, 'mod_book') . '</a>';
} else {
$chnavigation .= ' <a title="' . $navexit . '" class="bookexit" href="'.$returnurl.'">' .
'<span class="chaptername">' . $navexit . '&nbsp;' . $OUTPUT->uarrow() . '</span></a>';
Expand Down
10 changes: 10 additions & 0 deletions mod/choice/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1167,3 +1167,13 @@ function choice_check_updates_since(cm_info $cm, $from, $filter = array()) {

return $updates;
}

/**
* Get icon mapping for font-awesome.
*/
function mod_choice_get_fontawesome_icon_map() {
return [
'mod_choice:row' => 'fa-info',
'mod_choice:column' => 'fa-columns',
];
}
10 changes: 10 additions & 0 deletions mod/feedback/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -3316,3 +3316,13 @@ function feedback_can_view_analysis($feedback, $context, $courseid = false) {

return feedback_is_already_submitted($feedback->id, $courseid);
}

/**
* Get icon mapping for font-awesome.
*/
function mod_feedback_get_fontawesome_icon_map() {
return [
'mod_feedback:required' => 'fa-exclamation-circle',
'mod_feedback:notrequired' => 'fa-spacer',
];
}
5 changes: 4 additions & 1 deletion mod/forum/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -8079,7 +8079,10 @@ function forum_check_updates_since(cm_info $cm, $from, $filter = array()) {
return $updates;
}

function forum_get_fontawesome_icon_map() {
/**
* Get icon mapping for font-awesome.
*/
function mod_forum_get_fontawesome_icon_map() {
return [
'mod_forum:i/pinned' => 'fa-map-pin',
'mod_forum:t/selected' => 'fa-check',
Expand Down
9 changes: 9 additions & 0 deletions mod/glossary/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -4154,3 +4154,12 @@ function glossary_check_updates_since(cm_info $cm, $from, $filter = array()) {

return $updates;
}

/**
* Get icon mapping for font-awesome.
*/
function forum_get_fontawesome_icon_map() {
return [
'mod_glossary:export' => 'fa-download'
];
}
9 changes: 9 additions & 0 deletions mod/lesson/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1480,3 +1480,12 @@ function lesson_update_media_file($lessonid, $context, $draftitemid) {
$DB->set_field('lesson', 'mediafile', '', array('id' => $lessonid));
}
}

/**
* Get icon mapping for font-awesome.
*/
function mod_lesson_get_fontawesome_icon_map() {
return [
'mod_lesson:e/copy' => 'fa-clone',
];
}
9 changes: 9 additions & 0 deletions mod/lti/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -587,3 +587,12 @@ function lti_check_updates_since(cm_info $cm, $from, $filter = array()) {

return $updates;
}

/**
* Get icon mapping for font-awesome.
*/
function mod_lti_get_fontawesome_icon_map() {
return [
'mod_lti:warning' => 'fa-exclamation',
];
}
9 changes: 9 additions & 0 deletions mod/quiz/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2051,3 +2051,12 @@ function quiz_check_updates_since(cm_info $cm, $from, $filter = array()) {

return $updates;
}

/**
* Get icon mapping for font-awesome.
*/
function mod_quiz_get_fontawesome_icon_map() {
return [
'mod_quiz:navflagged' => 'fa-flag',
];
}
9 changes: 9 additions & 0 deletions mod/wiki/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -779,3 +779,12 @@ function wiki_check_updates_since(cm_info $cm, $from, $filter = array()) {
}
return $updates;
}

/**
* Get icon mapping for font-awesome.
*/
function mod_wiki_get_fontawesome_icon_map() {
return [
'mod_wiki:attachment' => 'fa-paperclip',
];
}
12 changes: 12 additions & 0 deletions mod/workshop/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1846,3 +1846,15 @@ function workshop_reset_userdata(stdClass $data) {

return $status;
}

/**
* Get icon mapping for font-awesome.
*/
function mod_workshop_get_fontawesome_icon_map() {
return [
'mod_workshop:userplan/task-info' => 'fa-info',
'mod_workshop:userplan/task-todo' => 'fa-square-o',
'mod_workshop:userplan/task-done' => 'fa-check',
'mod_workshop:userplan/task-fail' => 'fa-remove',
];
}
10 changes: 10 additions & 0 deletions question/type/ddmarker/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,13 @@ function qtype_ddmarker_pluginfile($course, $cm, $context, $filearea, $args, $fo
require_once($CFG->libdir . '/questionlib.php');
question_pluginfile($course, $context, 'qtype_ddmarker', $filearea, $args, $forcedownload, $options);
}

/**
* Get icon mapping for font-awesome.
*/
function qtype_ddmarker_get_fontawesome_icon_map() {
return [
'qtype_ddmarker:crosshairs' => 'fa-crosshairs',
'qtype_ddmarker:grid' => 'fa-th',
];
}

0 comments on commit 2b93145

Please sign in to comment.