You are here

function views_theme_wizard_views_theme_wizard_types in Views (for Drupal 7) 5

File

./views_theme_wizard.module, line 169

Code

function views_theme_wizard_views_theme_wizard_types($op = 'list', $delta = '', $view = NULL, $options = array()) {
  switch ($op) {
    case 'list':
      if ('list' == $op) {
        return array(
          'simple' => t('Simple List'),
          'grouped' => t('Grouped List'),
          'tree' => t('Nested Tree'),
        );
      }
    case 'configure':
      switch ($delta) {
        case 'simple':
          break;
        case 'grouped':
          $options = array();
          foreach ($view->field as $field) {
            $options[$field['queryname']] = $field['label'] ? $field['label'] : $field['queryname'];
          }
          $form['group_field'] = array(
            '#type' => 'select',
            '#title' => t('Select the field on which to group'),
            '#options' => $options,
          );
          $form['test'] = array(
            '#type' => 'markup',
          );
          return $form;
          break;
        case 'tree':
          $options = array();
          foreach ($view->field as $field) {
            $options[$field['queryname']] = $field['label'] ? $field['label'] : $field['queryname'];
          }
          $form['tree_key_field'] = array(
            '#type' => 'select',
            '#title' => t('Select the field to use as the ID for each row (usually nid)'),
            '#options' => $options,
          );
          $form['tree_reference_field'] = array(
            '#type' => 'select',
            '#title' => t('Select the field that refers to the parent node by the ID field'),
            '#options' => $options,
          );
          return $form;
          break;
      }
      break;
    case 'code':
      switch ($delta) {
        case 'simple':
          return views_theme_wizard_type_generate_code_simple($view);
          break;
        case 'grouped':
          return views_theme_wizard_type_generate_code_grouped($view, $options);
          break;
        case 'tree':
          return views_theme_wizard_type_generate_code_tree($view, $options);
          break;
      }
      break;
  }
}