marinaglancy / moodle-format_flexsections

25 stars 25 forks source link

Ampersand sign not showing correctly in Back #71

Closed pjonker closed 8 months ago

pjonker commented 1 year ago

Client uses the '&' sign in the name of a section. Within that section there is an activity. When you enter that activity you get the 'Back to [section name]' link. Within that link the '&' sign shows as '&'.

This has been tested on several Moodle sites and always gives the same issue.

Scherm­afbeelding 2023-09-12 om 13 43 41

duyphamluanh commented 11 months ago

After incorporating htmlspecialchars_decode into the get_section_name function, it now functions properly.

public function get_section_name($section) {
        if (!is_object($section)) {
            $section = $this->get_section($section);
        }
        if ((string)$section->name !== '') {
            // return format_string($section->name, true, ['context' => context_course::instance($this->courseid)]);
            return htmlspecialchars_decode(format_string($section->name, true, ['context' => context_course::instance($this->courseid)]));
        } else {
            return $this->get_default_section_name($section);
        }
    }
marinaglancy commented 8 months ago

Thank you, this was fixed in version 4.0.6