MDL-53407 themes: Add CSS class `editing` only if appropriate
authorJan C. Dageförde <jan.dagefoerde@ercis.uni-muenster.de>
Wed, 9 Mar 2016 15:45:42 +0000 (16:45 +0100)
committerJan C. Dageförde <jan.dagefoerde@ercis.uni-muenster.de>
Thu, 10 Mar 2016 09:44:48 +0000 (10:44 +0100)
The CSS class `editing` should only be added if the user is in editing
mode AND she is allowed to edit the rendered page. `user_is_editing()`
achieves exactly this, without changing behaviour for the appropriate
pages.

lib/pagelib.php

index 811234f..6c2cd9c 100644 (file)
@@ -1756,7 +1756,7 @@ class moodle_page {
             $this->add_body_class('notloggedin');
         }
 
-        if (!empty($USER->editing)) {
+        if ($this->user_is_editing()) {
             $this->add_body_class('editing');
             if (optional_param('bui_moveid', false, PARAM_INT)) {
                 $this->add_body_class('blocks-moving');