Answers.Body: <p>You could make a macro and use that as a "shortcut":</p>
  
  <pre><code>{% macro optionLabel(fieldHandle, optionValue) %}
  
      {%- set field = craft.fields.getFieldbyHandle(fieldHandle) %}
      {%- for option in field.settings.options %}
          {%- if option.value == optionValue %}
              {{- option.label }}
          {%- endif %}
      {%- endfor %}
  
  {%- endmacro %}
  {% import _self as macros %}
  
  &lt;h3&gt;{{ macros.optionLabel('newsType', 'newsValue') }}&lt;/h3&gt; 
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-06T11:53:18.937Z
Answers.Text: Interesting yes, I did not know about twig macros yet.
Answers.UserDisplayName: migmaker
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-06T10:32:06.360Z
Answers.LastActivityDate: 2015-10-06T10:32:06.360Z
Answers.UserDisplayName: carlcs
Answers.Body: <p>If you just want to get the selected radio button’s label, in the context of an existing entry, you can do this:</p>
  
  <pre class="lang-html prettyprint-override"><code>{% if entry.newsType|length %}
      &lt;h3 class="news-type"&gt;{{ entry.newsType.label }}&lt;/h3&gt;
  {% endif %}
  </code></pre>
  
  <p>(Documented here: <a href="http://buildwithcraft.com/docs/radio-buttons-fields#templating" rel="nofollow">http://buildwithcraft.com/docs/radio-buttons-fields#templating</a>)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-08T06:15:05.067Z
Answers.Text: Thx Brandon but thats the problem: I am not in the existing entry context : I have an entry type filter, I want to display the entry type (radio buttons) label that I am filtering on (from craft.request.segment(2)).
Answers.UserDisplayName: migmaker
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-08T13:16:30.873Z
Answers.Text: In that case the other answer is your best bet :)
Answers.UserDisplayName: Brandon Kelly
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-06T17:10:20.870Z
Answers.LastActivityDate: 2015-10-06T17:10:20.870Z
Answers.UserDisplayName: Brandon Kelly
Body: <p>Ok I know how to list radio buttons and use it to display a particular value:  </p>
  
  <pre><code>{% set newsType = craft.fields.getFieldbyHandle('newsType') %}
  {% for option in newsType.settings.options %}
      {% if option.value == 'newsValue' %}
          &lt;h3 class="news-type"&gt;{{  option.label }}&lt;/h3&gt;
      {% endif %}
  {% endfor %}
  </code></pre>
  
  <p>(I am not in an existing entry context.)
  So I would like to know if there is a shortcut to directly get this label from the value? Like that syntax :</p>
  
  <pre><code>{% set newsTypeLabel = craft.fields.getFieldbyHandle('newsType').option('newsValue').label) %}
  </code></pre>
  
Tags: <fieldtypes>
Title: Get label from value in radio buttons list fieldtype
ThreadText: # Get label from value in radio buttons list fieldtype
  
  (Asked by: username_0 on 2015-10-06)
  
  Ok I know how to list radio buttons and use it to display a particular value:
  
  ```
  {% set newsType = craft.fields.getFieldbyHandle('newsType') %}
  {% for option in newsType.settings.options %}
      {% if option.value == 'newsValue' %}
          <h3 class="news-type">{{  option.label }}</h3>
      {% endif %}
  {% endfor %}
  
  ```
  
  (I am not in an existing entry context.)
  So I would like to know if there is a shortcut to directly get this label from the value? Like that syntax :
  
  ```
  {% set newsTypeLabel = craft.fields.getFieldbyHandle('newsType').option('newsValue').label) %}
  
  ```
  
  **Tags:** fieldtypes
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2015-10-06. Score: 4 | Accepted answer
  
  You could make a macro and use that as a "shortcut":
  
  ```
  {% macro optionLabel(fieldHandle, optionValue) %}
  
      {%- set field = craft.fields.getFieldbyHandle(fieldHandle) %}
      {%- for option in field.settings.options %}
          {%- if option.value == optionValue %}
              {{- option.label }}
          {%- endif %}
      {%- endfor %}
  
  {%- endmacro %}
  {% import _self as macros %}
  
  <h3>{{ macros.optionLabel('newsType', 'newsValue') }}</h3> 
  
  ```
  
  > **Comments:**
  > **username_0**: Interesting yes, I did not know about twig macros yet.  
  
  ---
  
  ### Answer by username_2 on 2015-10-06. Score: 1
  
  If you just want to get the selected radio button’s label, in the context of an existing entry, you can do this:
  
  ```html
  {% if entry.newsType|length %}
      <h3 class="news-type">{{ entry.newsType.label }}</h3>
  {% endif %}
  
  ```
  
  (Documented here: <http://buildwithcraft.com/docs/radio-buttons-fields#templating>)
  
  > **Comments:**
  > **username_0**: Thx username_2 but thats the problem: I am not in the existing entry context : I have an entry type filter, I want to display the entry type (radio buttons) label that I am filtering on (from craft.request.segment(2)).  
  > **username_2**: In that case the other answer is your best bet :)  
  
  ---
  
  