original_string: public function inplace_editable_update_section_name($section, $itemtype, $newvalue) {
          if ($itemtype === 'sectionname' || $itemtype === 'sectionnamenl') {
              $context = context_course::instance($section->course);
              external_api::validate_context($context);
              require_capability('moodle/course:update', $context);
  
              $newtitle = clean_param($newvalue, PARAM_TEXT);
              if (strval($section->name) !== strval($newtitle)) {
                  course_update_section($section->course, $section, array('name' => $newtitle));
              }
              return $this->inplace_editable_render_section_name($section, ($itemtype === 'sectionname'), true);
          }
      }
code: public function inplace_editable_update_section_name($section, $itemtype, $newvalue) {
          if ($itemtype === 'sectionname' || $itemtype === 'sectionnamenl') {
              $context = context_course::instance($section->course);
              external_api::validate_context($context);
              require_capability('moodle/course:update', $context);
  
              $newtitle = clean_param($newvalue, PARAM_TEXT);
              if (strval($section->name) !== strval($newtitle)) {
                  course_update_section($section->course, $section, array('name' => $newtitle));
              }
              return $this->inplace_editable_render_section_name($section, ($itemtype === 'sectionname'), true);
          }
      }
code_tokens: public function inplace_editable_update_section_name ( $ section , $ itemtype , $ newvalue ) { if ( $ itemtype === 'sectionname' || $ itemtype === 'sectionnamenl' ) { $ context = context_course :: instance ( $ section -> course ) ; external_api :: validate_context ( $ context ) ; require_capability ( 'moodle/course:update' , $ context ) ; $ newtitle = clean_param ( $ newvalue , PARAM_TEXT ) ; if ( strval ( $ section -> name ) !== strval ( $ newtitle ) ) { course_update_section ( $ section -> course , $ section , array ( 'name' => $ newtitle ) ) ; } return $ this -> inplace_editable_render_section_name ( $ section , ( $ itemtype === 'sectionname' ) , true ) ; } }
docstring: Updates the value in the database and modifies this object respectively.
  
  ALWAYS check user permissions before performing an update! Throw exceptions if permissions are not sufficient
  or value is not legit.
  
  @param stdClass $section
  @param string $itemtype
  @param mixed $newvalue
  @return \core\output\inplace_editable
docstring_tokens: Updates the value in the database and modifies this object respectively .