public static function delete_field($id) {
        $params = self::validate_parameters(self::delete_field_parameters(), ['id' => $id]);

        $record = \core_customfield\field_controller::create($params['id']);
        $handler = $record->get_handler();
        if (!$handler->can_configure()) {
            throw new moodle_exception('nopermissionconfigure', 'core_customfield');
        }
        $handler->delete_field_configuration($record);
    }