You are here

function _recommender_views_template_user_field in Recommender API 7.6

1 call to _recommender_views_template_user_field()
_recommender_views_template_table in ./recommender.views.inc

File

./recommender.views.inc, line 168

Code

function _recommender_views_template_user_field($title, $help, $user_entity_info) {
  $return = array(
    'title' => $title,
    'help' => $help,
    'field' => array(
      // see [#2369101]

      //'handler' => 'views_handler_field_user',
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    // this is only valid in "base table". use "add relationship" to add users table.
    'relationship' => array(
      'handler' => 'views_handler_relationship',
      'base' => $user_entity_info['base table'],
      'base field' => $user_entity_info['entity keys']['id'],
      'label' => $title,
    ),
  );
  if ($user_entity_info['base table'] == 'users') {
    $return['filter'] = array(
      'handler' => 'views_handler_filter_user_name',
    );
    $return['argument'] = array(
      'handler' => 'views_handler_argument_user_uid',
    );
  }
  else {
    $return['filter'] = array(
      'handler' => 'views_handler_filter_numeric',
    );
    $return['argument'] = array(
      'handler' => 'views_handler_argument_numeric',
    );
  }
  return $return;
}