original_string: public function can_view(field_controller $field, int $instanceid) : bool {
          $visibility = $field->get_configdata_property('visibility');
          if ($visibility == self::NOTVISIBLE) {
              return false;
          } else if ($visibility == self::VISIBLETOTEACHERS) {
              return has_capability('moodle/course:update', $this->get_instance_context($instanceid));
          } else {
              return true;
          }
      }
code: public function can_view(field_controller $field, int $instanceid) : bool {
          $visibility = $field->get_configdata_property('visibility');
          if ($visibility == self::NOTVISIBLE) {
              return false;
          } else if ($visibility == self::VISIBLETOTEACHERS) {
              return has_capability('moodle/course:update', $this->get_instance_context($instanceid));
          } else {
              return true;
          }
      }
code_tokens: public function can_view ( field_controller $ field , int $ instanceid ) : bool { $ visibility = $ field -> get_configdata_property ( 'visibility' ) ; if ( $ visibility == self :: NOTVISIBLE ) { return false ; } else if ( $ visibility == self :: VISIBLETOTEACHERS ) { return has_capability ( 'moodle/course:update' , $ this -> get_instance_context ( $ instanceid ) ) ; } else { return true ; } }
docstring: The current user can view custom fields on the given course.
  
  @param field_controller $field
  @param int $instanceid id of the course to test edit permission
  @return bool true if the current can edit custom fields, false otherwise
docstring_tokens: The current user can view custom fields on the given course .