public static function move_category(int $id, int $beforeid) {
        $params = self::validate_parameters(self::move_category_parameters(),
            ['id' => $id, 'beforeid' => $beforeid]);
        $category = core_customfield\category_controller::create($id);
        $handler = $category->get_handler();
        self::validate_context($handler->get_configuration_context());
        if (!$handler->can_configure()) {
            throw new moodle_exception('nopermissionconfigure', 'core_customfield');
        }
        $handler->move_category($category, $params['beforeid']);
    }
public static function move_category(int $id, int $beforeid) {
        $params = self::validate_parameters(self::move_category_parameters(),
            ['id' => $id, 'beforeid' => $beforeid]);
        $category = core_customfield\category_controller::create($id);
        $handler = $category->get_handler();
        self::validate_context($handler->get_configuration_context());
        if (!$handler->can_configure()) {
            throw new moodle_exception('nopermissionconfigure', 'core_customfield');
        }
        $handler->move_category($category, $params['beforeid']);
    }
public static function move_category ( int $ id , int $ beforeid ) { $ params = self :: validate_parameters ( self :: move_category_parameters ( ) , [ 'id' => $ id , 'beforeid' => $ beforeid ] ) ; $ category = core_customfield \ category_controller :: create ( $ id ) ; $ handler = $ category -> get_handler ( ) ; self :: validate_context ( $ handler -> get_configuration_context ( ) ) ; if ( ! $ handler -> can_configure ( ) ) { throw new moodle_exception ( 'nopermissionconfigure' , 'core_customfield' ) ; } $ handler -> move_category ( $ category , $ params [ 'beforeid' ] ) ; }
Reorder categories. Move category to the new position

@param int $id category id
@param int $beforeid
Reorder categories . Move category to the new position