You are here

function profile_views_get_fields in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 5 modules/views_profile.inc \profile_views_get_fields()
  2. 6.3 modules/profile.views.inc \profile_views_get_fields()
  3. 6.2 modules/profile.views.inc \profile_views_get_fields()

Get all profile fields.

2 calls to profile_views_get_fields()
profile_views_data in modules/profile.views.inc
Implements hook_views_data().
views_handler_filter_profile_selection::get_value_options in modules/profile/views_handler_filter_profile_selection.inc
Child classes should be used to override this function and set the 'value options', unless 'options callback' is defined as a valid function or static public method to generate these values.

File

modules/profile.views.inc, line 65
Provide views data and handlers for user.module.

Code

function profile_views_get_fields() {
  static $fields = NULL;
  if (!isset($fields)) {
    $fields = array();
    $results = db_query("SELECT * FROM {profile_field} ORDER BY category, weight");
    foreach ($results as $row) {
      if (!empty($row->options)) {
        if (!in_array(substr($row->options, 0, 2), array(
          'a:',
          'b:',
          'i:',
          'f:',
          'o:',
          's:',
        ))) {

          // unserialized fields default version.
          $options = $row->options;
          unset($row->options);
          $row->options = $options;
        }
        else {

          // serialized fields or modified version.
          $row->options = unserialize($row->options);
        }
      }
      $fields[$row->fid] = $row;
    }
  }
  return $fields;
}