original_string: protected static function validate_workshop($workshopid) {
          global $DB, $USER;
  
          // Request and permission validation.
          $workshop = $DB->get_record('workshop', array('id' => $workshopid), '*', MUST_EXIST);
          list($course, $cm) = get_course_and_cm_from_instance($workshop, 'workshop');
  
          $context = context_module::instance($cm->id);
          self::validate_context($context);
  
          $workshop = new workshop($workshop, $cm, $course);
  
          return array($workshop, $course, $cm, $context);
      }
code: protected static function validate_workshop($workshopid) {
          global $DB, $USER;
  
          // Request and permission validation.
          $workshop = $DB->get_record('workshop', array('id' => $workshopid), '*', MUST_EXIST);
          list($course, $cm) = get_course_and_cm_from_instance($workshop, 'workshop');
  
          $context = context_module::instance($cm->id);
          self::validate_context($context);
  
          $workshop = new workshop($workshop, $cm, $course);
  
          return array($workshop, $course, $cm, $context);
      }
code_tokens: protected static function validate_workshop ( $ workshopid ) { global $ DB , $ USER ; // Request and permission validation. $ workshop = $ DB -> get_record ( 'workshop' , array ( 'id' => $ workshopid ) , '*' , MUST_EXIST ) ; list ( $ course , $ cm ) = get_course_and_cm_from_instance ( $ workshop , 'workshop' ) ; $ context = context_module :: instance ( $ cm -> id ) ; self :: validate_context ( $ context ) ; $ workshop = new workshop ( $ workshop , $ cm , $ course ) ; return array ( $ workshop , $ course , $ cm , $ context ) ; }
docstring: Utility function for validating a workshop.
  
  @param int $workshopid workshop instance id
  @return array array containing the workshop object, course, context and course module objects
  @since  Moodle 3.4
docstring_tokens: Utility function for validating a workshop .