You are here

function views_deploy_add_form in Deploy - Content Staging 6

Same name and namespace in other branches
  1. 5 views_deploy/views_deploy.module \views_deploy_add_form()

Display view add to deployment plan form.

Parameters

$form_state: FAPI form state

Return value

FAPI array

See also

views_deploy_add_form_submit()

1 string reference to 'views_deploy_add_form'
views_deploy_menu in modules/views_deploy/views_deploy.module
Implementation of hook_menu().

File

modules/views_deploy/views_deploy.pages.inc, line 17
Page handlers for content type deployment pages.

Code

function views_deploy_add_form($form_state) {
  $views = array();
  $plans = deploy_get_plan_options();
  $result = db_query("SELECT name FROM {views_view} ORDER BY name");
  while ($view = db_fetch_array($result)) {
    $views[$view['name']] = $view['name'];
  }
  if (!empty($views)) {
    $form['pid'] = array(
      '#title' => t('Deployment Plan'),
      '#type' => 'select',
      '#options' => $plans,
      '#description' => t('The deployment plan to add this view to'),
    );
    $form['view_name'] = array(
      '#title' => t('View'),
      '#type' => 'select',
      '#multiple' => TRUE,
      '#required' => TRUE,
      '#options' => $views,
      '#description' => t('The view(s) to deploy'),
    );
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Add to deployment plan'),
    );
    return $form;
  }
  else {
    drupal_set_message('You have no views available to deploy');
  }
}