Adding dynamic data to a custom dropdown field in Pages

Is it possible to get the results of a php query on a model and put the results in a custom filed in Pages? So if you query the Category model, you would put the results in the variable filed with type dropdown. I can’t get it to work, but would extending the filed in the plugin boot function work?

Thanks in advance.

difficult to help with so little details.
what and where do you mean when you say put the results in a custom filed in Pages ?

I remember doing this like this (not tested)

       // Extends the rainlab page model
        PageModel::extend(function ($model) {
            $model->addDynamicMethod('getCategoriesOptions', function () use ($model) {
                return \Author\Plugin\Models\MyModel::orderBy("name")->lists('name', 'id');
            });
        });