Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coding error detected, it must be fixed by a programmer: Invalid icon system requested. #21

Open
mczaja opened this issue Jul 11, 2023 · 6 comments

Comments

@mczaja
Copy link

mczaja commented Jul 11, 2023

Coding error detected, it must be fixed by a programmer: Invalid icon system requested '\core\output\icon_system_standard'
line 92 of /lib/classes/output/icon_system.php: coding_exception thrown
line 146 of /mod/pulse/mod_form.php: call to core\output\icon_system::instance()
line 214 of /lib/formslib.php: call to mod_pulse_mod_form->definition()
line 131 of /course/moodleform_mod.php: call to moodleform->__construct()
line 154 of /course/modedit.php: call to moodleform_mod->__construct()

Zrzut ekranu 2023-07-11 o 23 35 33

Would it be possible to incorporate an alternative solution for themes that don't based on the Boost and FontAwesome icon system?

Zrzut ekranu 2023-07-11 o 23 19 07

Moodle allows using 3 different icon styles:
1052852346

Thanks, Marcin

@stefanscholz
Copy link
Member

Hi @mczaja,

thanks for reporting this issue. We do indeed only support boost as a theme, and usually all themes that are based on Boost. Let me check with the developers how much effort it would be to support different icon styles.

Feel free to provide a pull request if you have the resources to do so and we'll review it.

I am surprised that there still exist themes that are not based on boost, is that a theme you built yourself or a third party one? I am curious to see it (if possible).

All the best
Stefan

@mczaja
Copy link
Author

mczaja commented Jul 19, 2023

Yes, it is the standalone theme. Built from scratch. (https://rosea.io/space2-theme/)

@stefanscholz
Copy link
Member

Oh, that explains why your name sounded familiar @mczaja — I actually like space it a lot, wasn't aware that it's not boost based. Good job!

@uaiblaine
Copy link

I don't know if it's the best approach, but I'm using the code below with no problems in Boost among other premium themes.

        // Preset Icon.
        $icon = $OUTPUT->image_url('i/edit', 'core')->out();

        $mform->addElement('html', '<img src="'.$icon.'">');
        $mform->addElement('text', 'boxicon', get_string('boxicon', 'pulse'));
        $mform->setType('boxicon', PARAM_TEXT);
        $mform->hideIf('boxicon', 'displaymode', 'neq', 1);

        $this->standard_coursemodule_elements();
        // Form submit and cancel buttons.
        $this->add_action_buttons(true, false, null);

@tlock
Copy link

tlock commented Nov 23, 2023

This is the fix that is needed to not assume the theme is configured with icons:

diff --git a/mod/pulse/mod_form.php b/mod/pulse/mod_form.php
index 08da3742de3..8e39dd9561c 100644
--- a/mod/pulse/mod_form.php
+++ b/mod/pulse/mod_form.php
@@ -143,12 +143,16 @@ class mod_pulse_mod_form extends moodleform_mod {
 
         // Preset Icon.
         $theme = \theme_config::load($PAGE->theme->name);
-        $faiconsystem = \core\output\icon_system_fontawesome::instance($theme->get_icon_system());
-        $iconlist = $faiconsystem->get_core_icon_map();
-        array_unshift($iconlist, '');
-        $mform->addElement('autocomplete', 'boxicon', get_string('boxicon', 'pulse'), $iconlist);
-        $mform->setType('boxicon', PARAM_TEXT);
-        $mform->hideIf('boxicon', 'displaymode', 'neq', 1);
+        if (!empty($theme->iconsystem)) {
+            $faiconsystem = \core\output\icon_system_fontawesome::instance($theme->get_icon_system());
+            $iconlist = $faiconsystem->get_core_icon_map();
+            array_unshift($iconlist, '');
+            $mform->addElement('autocomplete', 'boxicon', get_string('boxicon', 'pulse'), $iconlist);
+            $mform->setType('boxicon', PARAM_TEXT);
+            $mform->hideIf('boxicon', 'displaymode', 'neq', 1);
+        } else {
+            $mform->addElement('hidden', 'boxicon', get_string('boxicon', 'pulse'));
+        }
 
         $this->standard_coursemodule_elements();
         // Form submit and cancek buttons.

@Bq6mzBQlpX323V9v
Copy link

Dears.

I'm testing Pulse v. 1.3 build 2023051801 with latest version of Space Theme in Moodle 4.1.1 and got the above mentioned error (Coding error detected, it must..)

It seems the problem has been resolved but I don't understand how me, an average Moodle user can resolve it: Is there a new build of Pulse free with the error resolved? or Could anybody provide some brief Instructions on what file should I edit with the code described above?

Thanks in advance.
Fabian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants