original_string: public function is_editable() {
          global $USER;
  
          if (!$this->is_visible()) {
              return false;
          }
  
          if ($this->is_signup_field() && (empty($this->userid) || isguestuser($this->userid))) {
              // Allow editing the field on the signup page.
              return true;
          }
  
          $systemcontext = context_system::instance();
  
          if ($this->userid == $USER->id && has_capability('moodle/user:editownprofile', $systemcontext)) {
              return true;
          }
  
          if (has_capability('moodle/user:update', $systemcontext)) {
              return true;
          }
  
          return false;
      }
code: public function is_editable() {
          global $USER;
  
          if (!$this->is_visible()) {
              return false;
          }
  
          if ($this->is_signup_field() && (empty($this->userid) || isguestuser($this->userid))) {
              // Allow editing the field on the signup page.
              return true;
          }
  
          $systemcontext = context_system::instance();
  
          if ($this->userid == $USER->id && has_capability('moodle/user:editownprofile', $systemcontext)) {
              return true;
          }
  
          if (has_capability('moodle/user:update', $systemcontext)) {
              return true;
          }
  
          return false;
      }
code_tokens: public function is_editable ( ) { global $ USER ; if ( ! $ this -> is_visible ( ) ) { return false ; } if ( $ this -> is_signup_field ( ) && ( empty ( $ this -> userid ) || isguestuser ( $ this -> userid ) ) ) { // Allow editing the field on the signup page. return true ; } $ systemcontext = context_system :: instance ( ) ; if ( $ this -> userid == $ USER -> id && has_capability ( 'moodle/user:editownprofile' , $ systemcontext ) ) { return true ; } if ( has_capability ( 'moodle/user:update' , $ systemcontext ) ) { return true ; } return false ; }
docstring: Check if the field data is editable for the current user
  This method should not generally be overwritten by child classes.
  @return bool
docstring_tokens: Check if the field data is editable for the current user This method should not generally be overwritten by child classes .