You are here

function slick_views_get_defined_field_options in Slick Views 7.2

Returns available fields for select options.

1 call to slick_views_get_defined_field_options()
_slick_views_options_form in includes/admin.inc
Off-loaded SlickViews::options_form().

File

includes/admin.inc, line 11
Contains functions called only by admin pages.

Code

function slick_views_get_defined_field_options($view) {
  $fields = $view->display_handler
    ->get_handlers('field');
  $options = array();
  $classes = array(
    'list_text',
    'entityreference',
    'taxonomy_term_reference',
    'text',
  );
  foreach ($fields as $field => $handler) {
    if (isset($handler->field_info)) {
      $type = $handler->field_info['type'];
      switch ($type) {
        case 'file':
        case 'image':
        case 'youtube':
        case 'video_embed_field':
          $options['images'][$field] = $handler
            ->ui_name();
          $options['overlays'][$field] = $handler
            ->ui_name();
          $options['thumbnails'][$field] = $handler
            ->ui_name();
          break;
        case 'list_text':
          $options['layouts'][$field] = $handler
            ->ui_name();
          break;
        case 'entityreference':
        case 'text':
        case 'text_long':
        case 'text_with_summary':
        case 'link_field':
          $options['links'][$field] = $handler
            ->ui_name();
          $options['titles'][$field] = $handler
            ->ui_name();
          if ($type != 'link_field') {
            $options['thumb_captions'][$field] = $handler
              ->ui_name();
          }
          break;
      }
      if (in_array($type, $classes)) {
        $options['classes'][$field] = $handler
          ->ui_name();
      }
    }

    // Content: title is not really a field, unless title.module installed.
    if ($handler->field == 'title') {
      $options['classes'][$field] = $handler
        ->ui_name();
      $options['titles'][$field] = $handler
        ->ui_name();
      $options['thumb_captions'][$field] = $handler
        ->ui_name();
    }
    if ($handler->field == 'nothing') {
      $options['classes'][$field] = $handler
        ->ui_name();
      $options['links'][$field] = $handler
        ->ui_name();
    }
    if ($handler->field == 'view_node') {
      $options['links'][$field] = $handler
        ->ui_name();
    }

    // Caption can be anything to get custom works going.
    $options['captions'][$field] = $handler
      ->ui_name();
  }
  return $options;
}