original_string: function delete_field() {
          global $DB;
  
          if (!empty($this->field->id)) {
              // Get the field before we delete it.
              $field = $DB->get_record('data_fields', array('id' => $this->field->id));
  
              $this->delete_content();
              $DB->delete_records('data_fields', array('id'=>$this->field->id));
  
              // Trigger an event for deleting this field.
              $event = \mod_data\event\field_deleted::create(array(
                  'objectid' => $this->field->id,
                  'context' => $this->context,
                  'other' => array(
                      'fieldname' => $this->field->name,
                      'dataid' => $this->data->id
                   )
              ));
              $event->add_record_snapshot('data_fields', $field);
              $event->trigger();
          }
  
          return true;
      }
code: function delete_field() {
          global $DB;
  
          if (!empty($this->field->id)) {
              // Get the field before we delete it.
              $field = $DB->get_record('data_fields', array('id' => $this->field->id));
  
              $this->delete_content();
              $DB->delete_records('data_fields', array('id'=>$this->field->id));
  
              // Trigger an event for deleting this field.
              $event = \mod_data\event\field_deleted::create(array(
                  'objectid' => $this->field->id,
                  'context' => $this->context,
                  'other' => array(
                      'fieldname' => $this->field->name,
                      'dataid' => $this->data->id
                   )
              ));
              $event->add_record_snapshot('data_fields', $field);
              $event->trigger();
          }
  
          return true;
      }
code_tokens: function delete_field ( ) { global $ DB ; if ( ! empty ( $ this -> field -> id ) ) { // Get the field before we delete it. $ field = $ DB -> get_record ( 'data_fields' , array ( 'id' => $ this -> field -> id ) ) ; $ this -> delete_content ( ) ; $ DB -> delete_records ( 'data_fields' , array ( 'id' => $ this -> field -> id ) ) ; // Trigger an event for deleting this field. $ event = \ mod_data \ event \ field_deleted :: create ( array ( 'objectid' => $ this -> field -> id , 'context' => $ this -> context , 'other' => array ( 'fieldname' => $ this -> field -> name , 'dataid' => $ this -> data -> id ) ) ) ; $ event -> add_record_snapshot ( 'data_fields' , $ field ) ; $ event -> trigger ( ) ; } return true ; }
docstring: Delete a field completely
  
  @global object
  @return bool
docstring_tokens: Delete a field completely