function views_fetch_fields

cis7 admin.inc views_fetch_fields($base, $type, $grouping = FALSE)
cle7 admin.inc views_fetch_fields($base, $type, $grouping = FALSE)
elmsmedia7 admin.inc views_fetch_fields($base, $type, $grouping = FALSE)
icor7 admin.inc views_fetch_fields($base, $type, $grouping = FALSE)
meedjum_blog7 admin.inc views_fetch_fields($base, $type, $grouping = FALSE)
mooc7 admin.inc views_fetch_fields($base, $type, $grouping = FALSE)

Fetch a list of all fields available for a given base type.

Parameters

(array|string) $base: A list or a single base_table, for example node.

string $type: The handler type, for example field or filter.

bool $grouping: Should the result grouping by its 'group' label.

Return value

array A keyed array of in the form of 'base_table' => 'Description'.

6 calls to views_fetch_fields()
date_views_views_fetch_fields in sites/all/modules/ulmus/date/date_views/date_views.module
Wrapper function to make sure this function will always work.
ViewsUiBaseViewsWizard::build_filters in sites/all/modules/ulmus/views/plugins/views_wizard/views_ui_base_views_wizard.class.php
Build the part of the form that allows the user to select the view's filters.
ViewsUiBaseViewsWizard::default_display_filters_user in sites/all/modules/ulmus/views/plugins/views_wizard/views_ui_base_views_wizard.class.php
views_handler_relationship_groupwise_max::options_form in sites/all/modules/ulmus/views/handlers/views_handler_relationship_groupwise_max.inc
Extends the relationship's basic options, allowing the user to pick a sort and an order for it.
views_ui_add_item_form in sites/all/modules/ulmus/views/includes/admin.inc
Form to add_item items in the views UI.

... See full list

File

sites/all/modules/ulmus/views/includes/admin.inc, line 5131
Provides the Views' administrative interface.

Code

function views_fetch_fields($base, $type, $grouping = FALSE) {
  static $fields = array();
  if (empty($fields)) {
    $data = views_fetch_data();
    $start = microtime(TRUE);
    // This constructs this ginormous multi dimensional array to
    // collect the important data about fields. In the end,
    // the structure looks a bit like this (using nid as an example)
    // $strings['nid']['filter']['title'] = 'string'.
    //
    // This is constructed this way because the above referenced strings
    // can appear in different places in the actual data structure so that
    // the data doesn't have to be repeated a lot. This essentially lets
    // each field have a cheap kind of inheritance.

    foreach ($data as $table => $table_data) {
      $bases = array();
      $strings = array();
      $skip_bases = array();
      foreach ($table_data as $field => $info) {
        // Collect table data from this table
        if ($field == 'table') {
          // calculate what tables this table can join to.
          if (!empty($info['join'])) {
            $bases = array_keys($info['join']);
          }
          // And it obviously joins to itself.
          $bases[] = $table;
          continue;
        }
        foreach (array(
          'field',
          'sort',
          'filter',
          'argument',
          'relationship',
          'area',
        ) as $key) {
          if (!empty($info[$key])) {
            if ($grouping && !empty($info[$key]['no group by'])) {
              continue;
            }
            if (!empty($info[$key]['skip base'])) {
              foreach ((array) $info[$key]['skip base'] as $base_name) {
                $skip_bases[$field][$key][$base_name] = TRUE;
              }
            }
            elseif (!empty($info['skip base'])) {
              foreach ((array) $info['skip base'] as $base_name) {
                $skip_bases[$field][$key][$base_name] = TRUE;
              }
            }
            // Don't show old fields. The real field will be added right.
            if (isset($info[$key]['moved to'])) {
              continue;
            }
            foreach (array(
              'title',
              'group',
              'help',
              'base',
              'aliases',
            ) as $string) {
              // First, try the lowest possible level
              if (!empty($info[$key][$string])) {
                $strings[$field][$key][$string] = $info[$key][$string];
              }
              // Then try the field level
              elseif (!empty($info[$string])) {
                $strings[$field][$key][$string] = $info[$string];
              }
              // Finally, try the table level
              elseif (!empty($table_data['table'][$string])) {
                $strings[$field][$key][$string] = $table_data['table'][$string];
              }
              else {
                if ($string != 'base' && $string != 'base') {
                  $strings[$field][$key][$string] = t("Error: missing @component", array('@component' => $string));
                }
              }
            }
          }
        }
      }
      foreach ($bases as $base_name) {
        foreach ($strings as $field => $field_strings) {
          foreach ($field_strings as $type_name => $type_strings) {
            if (empty($skip_bases[$field][$type_name][$base_name])) {
              $fields[$base_name][$type_name]["$table.$field"] = $type_strings;
            }
          }
        }
      }
    }
    //    vsm('Views UI data build time: ' . (views_microtime() - $start) * 1000 . ' ms');
  }

  // If we have an array of base tables available, go through them
  // all and add them together. Duplicate keys will be lost and that's
  // Just Fine.
  if (is_array($base)) {
    $strings = array();
    foreach ($base as $base_table) {
      if (isset($fields[$base_table][$type])) {
        $strings += $fields[$base_table][$type];
      }
    }
    uasort($strings, '_views_sort_types');
    return $strings;
  }

  if (isset($fields[$base][$type])) {
    uasort($fields[$base][$type], '_views_sort_types');
    return $fields[$base][$type];
  }
  return array();
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.