original_string: public static function edit_section($action, $id, $sectionreturn) {
          global $DB;
          // Validate and normalize parameters.
          $params = self::validate_parameters(self::edit_section_parameters(),
              array('action' => $action, 'id' => $id, 'sectionreturn' => $sectionreturn));
          $action = $params['action'];
          $id = $params['id'];
          $sr = $params['sectionreturn'];
  
          $section = $DB->get_record('course_sections', array('id' => $id), '*', MUST_EXIST);
          $coursecontext = context_course::instance($section->course);
          self::validate_context($coursecontext);
  
          $rv = course_get_format($section->course)->section_action($section, $action, $sectionreturn);
          if ($rv) {
              return json_encode($rv);
          } else {
              return null;
          }
      }
code: public static function edit_section($action, $id, $sectionreturn) {
          global $DB;
          // Validate and normalize parameters.
          $params = self::validate_parameters(self::edit_section_parameters(),
              array('action' => $action, 'id' => $id, 'sectionreturn' => $sectionreturn));
          $action = $params['action'];
          $id = $params['id'];
          $sr = $params['sectionreturn'];
  
          $section = $DB->get_record('course_sections', array('id' => $id), '*', MUST_EXIST);
          $coursecontext = context_course::instance($section->course);
          self::validate_context($coursecontext);
  
          $rv = course_get_format($section->course)->section_action($section, $action, $sectionreturn);
          if ($rv) {
              return json_encode($rv);
          } else {
              return null;
          }
      }
code_tokens: public static function edit_section ( $ action , $ id , $ sectionreturn ) { global $ DB ; // Validate and normalize parameters. $ params = self :: validate_parameters ( self :: edit_section_parameters ( ) , array ( 'action' => $ action , 'id' => $ id , 'sectionreturn' => $ sectionreturn ) ) ; $ action = $ params [ 'action' ] ; $ id = $ params [ 'id' ] ; $ sr = $ params [ 'sectionreturn' ] ; $ section = $ DB -> get_record ( 'course_sections' , array ( 'id' => $ id ) , '*' , MUST_EXIST ) ; $ coursecontext = context_course :: instance ( $ section -> course ) ; self :: validate_context ( $ coursecontext ) ; $ rv = course_get_format ( $ section -> course ) -> section_action ( $ section , $ action , $ sectionreturn ) ; if ( $ rv ) { return json_encode ( $ rv ) ; } else { return null ; } }
docstring: Performs one of the edit section actions
  
  @since Moodle 3.3
  @param string $action
  @param int $id section id
  @param int $sectionreturn section to return to
  @return string
docstring_tokens: Performs one of the edit section actions