function profile_views_get_fields

Same name in other branches
  1. 7.x-3.x modules/profile.views.inc \profile_views_get_fields()

Get all profile fields

Related topics

3 calls to profile_views_get_fields()
profile_views_convert in modules/profile.views_convert.inc
Implementation of hook_views_convert().
profile_views_data in modules/profile.views.inc
Implementation of 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 67

Code

function profile_views_get_fields() {
    static $fields = NULL;
    if (!isset($fields)) {
        $fields = array();
        $results = db_query("SELECT * FROM {profile_fields} ORDER BY category, weight");
        while ($row = db_fetch_object($results)) {
            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(db_decode_blob($row->options));
                }
            }
            $fields[$row->fid] = $row;
        }
    }
    return $fields;
}