You are here

function views_deploy_add_form in Deploy - Content Staging 5

Same name and namespace in other branches
  1. 6 modules/views_deploy/views_deploy.pages.inc \views_deploy_add_form()

deploy view form

1 string reference to 'views_deploy_add_form'
views_deploy_menu in views_deploy/views_deploy.module
implementation of hook menu

File

views_deploy/views_deploy.module, line 28

Code

function views_deploy_add_form($plans) {
  $views = array();
  $result = db_query("SELECT name FROM {view_view} ORDER BY name");
  while ($view = db_fetch_array($result)) {
    $views[$view['name']] = $view['name'];
  }
  $form['pid'] = array(
    '#title' => t('Deployment Plan'),
    '#type' => 'select',
    '#options' => $plans,
    '#description' => t('The deployment plan to add this view to'),
  );
  if (module_exists('hs_flatlist')) {
    $form['view_name'] = array(
      '#title' => t('View'),
      '#type' => 'hierarchical_select',
      '#required' => TRUE,
      '#config' => array(
        'module' => 'hs_flatlist',
        'params' => array(
          'options' => $views,
        ),
        'dropbox' => array(
          'status' => 1,
          'title' => t('Selected views'),
        ),
      ),
      '#description' => t('The views to deploy.'),
    );
  }
  else {
    $form['view_name'] = array(
      '#title' => t('View'),
      '#type' => 'select',
      '#multiple' => TRUE,
      '#required' => TRUE,
      '#options' => $views,
      '#description' => t('The views to deploy.'),
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  return $form;
}