Answers.Body: <p>Take a look at the file <a href="https://github.com/civicrm/civicrm-drupal/blob/7.x-4.7.11/modules/views/civicrm/civicrm_handler_field_pseudo_constant.inc" rel="nofollow">civicrm_handler_field_pseudo_constant.inc</a> - this is what handles the option value lookup.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-26T15:09:35.953Z
Answers.Text: Thank you Coleman - I'll accept your answer and give more detail when I've tried it out :)
Answers.UserDisplayName: JohnFF
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-27T11:20:09.910Z
Answers.Text: In case it's useful to anyone, the exact change I needed was to include $this->render_fields() around $view->result in the render() function of the views_plugin inheriting class. The output is then in views->style_plugin->rendered_fields.
Answers.UserDisplayName: JohnFF
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-26T14:47:35.430Z
Answers.LastActivityDate: 2016-09-26T14:47:35.430Z
Answers.UserDisplayName: Coleman
Body: <p>I'm making a Views Plugin, a 'format type', and when I use CiviCRM Contact Gender as a field, it returns a Gender ID. That's to be expected. But when I use the other Views formats (HTML, grid, etc) it shows the actual gender.</p>
  
  <p>Does anyone know why it is changing it to male, female etc on the standard ones, but leaving it as an ID on my new format? </p>
  
  <p>Thanks,</p>
  
  <p>Update - to be clear I understand that this is stored in the contact table as an ID that is looked up elsewhere. My question is - does anyone know how it's being looked up in the options table by standard views plugins, but not by mine?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-09-26T07:58:36.810Z
Comments.Text: I hope you know that gender_id is stored as numbers in the civicrm_contact table in the database. The actual label of Man and Woman is stored in a different table civicrm_option_value. So probably the pre-existing Views has made that connection already, but not the ones you create
Comments.UserDisplayName: Flying
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-09-26T08:37:25.770Z
Comments.Text: Updated ticket to answer Flying's question. To confirm, I did understand that. My question is, how do existing Views do that?
Comments.UserDisplayName: JohnFF
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-09-26T08:39:23.753Z
Comments.Text: I don't know, that is why I din't answer, just commented:-)
Comments.UserDisplayName: Flying
Tags: <drupal><drupal-views>
Title: Drupal Views - Views Plugin - Gender ID
ThreadText: # Drupal Views - Views Plugin - Gender ID
  
  (Asked by: username_0 on 2016-09-25)
  
  I'm making a Views Plugin, a 'format type', and when I use CiviCRM Contact Gender as a field, it returns a Gender ID. That's to be expected. But when I use the other Views formats (HTML, grid, etc) it shows the actual gender.
  
  Does anyone know why it is changing it to male, female etc on the standard ones, but leaving it as an ID on my new format?
  
  Thanks,
  
  Update - to be clear I understand that this is stored in the contact table as an ID that is looked up elsewhere. My question is - does anyone know how it's being looked up in the options table by standard views plugins, but not by mine?
  
  **Tags:** drupal, drupal-views
  
  > **Comments:**
  > **username_1**: I hope you know that gender_id is stored as numbers in the civicrm_contact table in the database. The actual label of Man and Woman is stored in a different table civicrm_option_value. So probably the pre-existing Views has made that connection already, but not the ones you create  
  > **username_0**: Updated ticket to answer username_1's question. To confirm, I did understand that. My question is, how do existing Views do that?  
  > **username_1**: I don't know, that is why I din't answer, just commented:-)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2016-09-26. Score: 2 | Accepted answer
  
  Take a look at the file [civicrm\_handler\_field\_pseudo\_constant.inc](https://github.com/civicrm/civicrm-drupal/blob/7.x-4.7.11/modules/views/civicrm/civicrm_handler_field_pseudo_constant.inc) - this is what handles the option value lookup.
  
  > **Comments:**
  > **username_0**: Thank you username_2 - I'll accept your answer and give more detail when I've tried it out :)  
  > **username_0**: In case it's useful to anyone, the exact change I needed was to include $this->render_fields() around $view->result in the render() function of the views_plugin inheriting class. The output is then in views->style_plugin->rendered_fields.  
  
  ---
  
  