Skip to content

Commit

Permalink
fixup! MDL-82313 mod_data: refactor field icon display
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentdavid committed Nov 12, 2024
1 parent 557fe73 commit f521ca1
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mod/data/classes/output/action_bar.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function get_create_fields(bool $isprimarybutton = false): \action_menu {
$fieldselectparams['newtype'] = $fieldtype;
$fieldselect->add(new \action_menu_link(
new moodle_url('/mod/data/field.php', $fieldselectparams),
new \image_icon('icon', $fieldtype, 'datafield_' . $fieldtype),
new \pix_icon('icon', $fieldtype, 'datafield_' . $fieldtype),
$fieldname,
false
));
Expand Down
22 changes: 21 additions & 1 deletion mod/data/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ function name() {
function image() {
global $OUTPUT;

return $OUTPUT->image_icon('icon', $this->type, 'datafield_' . $this->type);
return $OUTPUT->pix_icon('icon', $this->type, 'datafield_' . $this->type);
}

/**
Expand Down Expand Up @@ -4120,6 +4120,26 @@ function data_view($data, $course, $cm, $context) {
$completion->set_module_viewed($cm);
}

/**
* Get icon mapping for font-awesome.
*/
function mod_data_get_fontawesome_icon_map() {
return [
'mod_data:field/checkbox' => 'fa-regular fa-square-check',
'mod_data:field/date' => 'fa-regular fa-calendar',
'mod_data:field/file' => 'fa-regular fa-file',
'mod_data:field/latlong' => 'fa-earth-americas',
'mod_data:field/menu' => 'fa-bars',
'mod_data:field/multimenu' => 'fa-bars',
'mod_data:field/number' => 'fa-hashtag',
'mod_data:field/picture' => 'fa-regular fa-image',
'mod_data:field/radiobutton' => 'fa-regular fa-circle-dot',
'mod_data:field/text' => 'fa-i-cursor',
'mod_data:field/textarea' => 'fa-font',
'mod_data:field/url' => 'fa-link',
];
}

/**
* Get the list of deprecated icons.
*
Expand Down
1 change: 1 addition & 0 deletions mod/data/pix/field/checkbox.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mod/data/pix/field/date.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mod/data/pix/field/file.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mod/data/pix/field/latlong.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mod/data/pix/field/menu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mod/data/pix/field/multimenu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mod/data/pix/field/number.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mod/data/pix/field/picture.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mod/data/pix/field/radiobutton.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mod/data/pix/field/text.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions mod/data/pix/field/textarea.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mod/data/pix/field/url.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f521ca1

Please sign in to comment.