MDL-58559 block_community: check if the course has subject
authorSimey Lameze <simey@moodle.com>
Tue, 11 Apr 2017 03:21:38 +0000 (11:21 +0800)
committerSimey Lameze <simey@moodle.com>
Tue, 18 Apr 2017 00:56:07 +0000 (08:56 +0800)
blocks/community/renderer.php

index c945b00..f29d301 100644 (file)
@@ -153,7 +153,8 @@ class block_community_renderer extends plugin_renderer_base {
                                 array('class' => 'hubcourseuserinfo'));
 
                 //create course content related information html
-                $course->subject = get_string($course->subject, 'edufields');
+                $course->subject = (get_string_manager()->string_exists($course->subject, 'edufields')) ?
+                        get_string($course->subject, 'edufields') : get_string('none');
                 $course->audience = get_string('audience' . $course->audience, 'hub');
                 $course->educationallevel = get_string('edulevel' . $course->educationallevel, 'hub');
                 $coursecontentinfo = '';