WordPress Form-Plugin get Dropdown Values from SQL query

I am using a Form Plugin in WordPress and I would need a dropdown field which gets its values from a SQL query.
Right now I have one function which gets all WordPress users:

function my_dropdown_users(iPhorm $form)
{
    $dropdown = $form->getElement('iphorm_27_3');

    if ( ! $dropdown instanceof iPhorm_Element_Select) {
        return;
    }

    $users = array();

    foreach (get_users() as $user) {
        $users[] = array(
            'label' => $user->display_name,
            'value' => $user->display_name
        );
    }

    $dropdown->setOptions($users);
}

add_filter('iphorm_pre_display_27', 'my_dropdown_users');

Is there a way to change that array so the it gets the the results from a custom SELECT query?

Related posts