How to select a view inside a custom module form I would like to have "select" with some views so I can chosse one of them and the submit the selection to display the result. something like this:



And this is close to what I want :

  $form['title'] = array(
'#type' =&gt; 'select',
'#title' =&gt; t('Display amount'),
//'#required' =&gt; TRUE,
'#options' =&gt; drupal_map_assoc(array('1','2', '3', '4', '5', '6', '7', '8')),
'#default_value' =&gt; 5,
'#ajax' =&gt; array(
    'callback' =&gt; 'form_ajax_submit',
    'wrapper' =&gt; 'contenido-div',
    'method' =&gt; 'replace',
    'effect' =&gt; 'fade',
   ),
    );

 $form['content'] = array(
'#type' =&gt; 'select',
'#title' =&gt; t('Content'),
'#options' =&gt; array(node_type_get_names()),
'#ajax' =&gt; array(
    'callback' =&gt; 'form_ajax_submit',
    'wrapper' =&gt; 'contenido-div',
    'method' =&gt; 'replace',
    'effect' =&gt; 'fade',
),
);

$form['views'] = array(
'#type' =&gt; 'select',
'#title' =&gt; t('views'),
'#options' =&gt; array(),
'#ajax' =&gt; array(
    'callback' =&gt; 'form_ajax_submit',
    'wrapper' =&gt; 'contenido-div',
    'method' =&gt; 'replace',
    'effect' =&gt; 'fade',
 ),
);


Thanks
As Views is a CTools Export UI based module, the correct way to load all views is by using the CTools Export function: ctool_export_crud_load_all()

Example

ctools_include('export');
$views = ctools_export_crud_load_all('views_view');
$options = array();
foreach ($views as $view_id =&gt; $view) {
  $options[$view_id] = $view-&gt;human_name;
}