public function course_section_cm_unavailable_error_message(cm_info $cm) {
        if ($cm->uservisible) {
            return null;
        }
        if (!$cm->availableinfo) {
            return get_string('activityiscurrentlyhidden');
        }

        $altname = get_accesshide(' ' . $cm->modfullname);
        $name = html_writer::empty_tag('img', array('src' => $cm->get_icon_url(),
                'class' => 'iconlarge activityicon', 'alt' => ' ', 'role' => 'presentation')) .
            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') .
        html_writer::div($formattedinfo, 'availabilityinfo-error');
    }