You are here

function ds_extras_vd_overview 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_overview()

Show the overview form and the selection list.

1 string reference to 'ds_extras_vd_overview'
ds_extras_menu in modules/ds_extras/ds_extras.module
Implements hook_menu().

File

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

Code

function ds_extras_vd_overview() {
  $entity_info = entity_get_info('ds_views');
  $build = $rows = array();
  ctools_include('export');
  $vd_settings = ctools_export_crud_load_all('ds_vd');
  if ($entity_info) {
    foreach ($entity_info['bundles'] as $key => $value) {

      // If no initial bundles were created, entity API will create
      // one by default, so make sure we do not list that one.
      if ($key == 'ds_views') {
        continue;
      }
      $row = array();
      $row[] = $value['label'];
      $operations = l(t('Manage layout'), 'admin/structure/ds/vd/manage/' . $key . '/display');
      if (isset($vd_settings[$key]) && $vd_settings[$key]->export_type == 1) {
        $operations .= ' - ' . l(t('Remove'), 'admin/structure/ds/vd/manage/' . $key . '/remove');
      }
      $row[] = $operations;
      $rows[$key] = $row;
    }
  }
  if (empty($rows)) {
    $rows = array(
      array(
        array(
          'data' => t('No views selected.'),
          'colspan' => '2',
        ),
      ),
    );
  }
  $variables = array(
    'header' => array(
      t('Title'),
      t('Operations'),
    ),
    'rows' => $rows,
  );
  $build['list'] = array(
    '#markup' => theme('table', $variables),
  );
  $build['form'] = drupal_get_form('ds_extras_vd_bundle_form', $rows);
  return $build;
}