original_string: public function delete() : bool {
          global $DB;
          $fs = get_file_storage();
  
          // Delete files in the defaultvalue.
          $fs->delete_area_files($this->get_handler()->get_configuration_context()->id, 'customfield_textarea',
              'defaultvalue', $this->get('id'));
  
          // Delete files in the data. We can not use $fs->delete_area_files_select() because context may be different.
          $params = ['component' => 'customfield_textarea', 'filearea' => 'value', 'fieldid' => $this->get('id')];
          $where = "component = :component AND filearea = :filearea
                  AND itemid IN (SELECT cfd.id FROM {customfield_data} cfd WHERE cfd.fieldid = :fieldid)";
          $filerecords = $DB->get_recordset_select('files', $where, $params);
          foreach ($filerecords as $filerecord) {
              $fs->get_file_instance($filerecord)->delete();
          }
          $filerecords->close();
  
          // Delete data and field.
          return parent::delete();
      }
code: public function delete() : bool {
          global $DB;
          $fs = get_file_storage();
  
          // Delete files in the defaultvalue.
          $fs->delete_area_files($this->get_handler()->get_configuration_context()->id, 'customfield_textarea',
              'defaultvalue', $this->get('id'));
  
          // Delete files in the data. We can not use $fs->delete_area_files_select() because context may be different.
          $params = ['component' => 'customfield_textarea', 'filearea' => 'value', 'fieldid' => $this->get('id')];
          $where = "component = :component AND filearea = :filearea
                  AND itemid IN (SELECT cfd.id FROM {customfield_data} cfd WHERE cfd.fieldid = :fieldid)";
          $filerecords = $DB->get_recordset_select('files', $where, $params);
          foreach ($filerecords as $filerecord) {
              $fs->get_file_instance($filerecord)->delete();
          }
          $filerecords->close();
  
          // Delete data and field.
          return parent::delete();
      }
code_tokens: public function delete ( ) : bool { global $ DB ; $ fs = get_file_storage ( ) ; // Delete files in the defaultvalue. $ fs -> delete_area_files ( $ this -> get_handler ( ) -> get_configuration_context ( ) -> id , 'customfield_textarea' , 'defaultvalue' , $ this -> get ( 'id' ) ) ; // Delete files in the data. We can not use $fs->delete_area_files_select() because context may be different. $ params = [ 'component' => 'customfield_textarea' , 'filearea' => 'value' , 'fieldid' => $ this -> get ( 'id' ) ] ; $ where = "component = :component AND filearea = :filearea
                  AND itemid IN (SELECT cfd.id FROM {customfield_data} cfd WHERE cfd.fieldid = :fieldid)" ; $ filerecords = $ DB -> get_recordset_select ( 'files' , $ where , $ params ) ; foreach ( $ filerecords as $ filerecord ) { $ fs -> get_file_instance ( $ filerecord ) -> delete ( ) ; } $ filerecords -> close ( ) ; // Delete data and field. return parent :: delete ( ) ; }
docstring: Before delete bulk actions
docstring_tokens: Before delete bulk actions