You are here

function ds_extras_vd_bundle_form in Display Suite 7

Same name and namespace in other branches
  1. 7.2 modules/ds_extras/includes/ds_extras.vd.inc \ds_extras_vd_bundle_form()

Return the views select form to create a bundle.

1 string reference to 'ds_extras_vd_bundle_form'
ds_extras_vd_overview in modules/ds_extras/ds_extras.vd.inc
Show the overview form and the selection list.

File

modules/ds_extras/ds_extras.vd.inc, line 60
Views displays functions.

Code

function ds_extras_vd_bundle_form($form, $form_state, $rows) {
  $options = array();
  $views = views_get_all_views();
  foreach ($views as $view_key => $view) {

    // Ignore disabled views.
    if (isset($view->disabled) && $view->disabled) {
      continue;
    }
    $get_view = views_get_view($view->name);

    // Loop through all displays.
    foreach ($view->display as $display_key => $display) {

      // Ignore default displays.
      if ($display_key == 'default') {
        continue;
      }
      $key = $view_key . '-' . $display_key;
      $name = drupal_ucfirst($view->name) . ': ' . $display->display_title;
      if (!isset($rows[$key])) {
        $options[$key] = $name . ' (Views template)';
      }
      $get_view
        ->set_display($display_key);
      if ($get_view->display_handler
        ->uses_fields() && !isset($rows[$key . '-fields'])) {
        $options[$key . '-fields'] = $name . ' (Fields)';
      }
    }
  }
  $form['vd'] = array(
    '#title' => t('Select view'),
    '#description' => t('Select a View that you want to manage with Display Suite. If a View uses fields you can also select that view to select a layout and position the fields. Note that html for the label and field are limited.'),
    '#type' => 'select',
    '#options' => $options,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Add'),
  );
  return $form;
}