If I need override views field template with value of another field,

i write in 

views-view-field-VIEW-NAME--DISPLAY-NAME--FIELD-NAME.html.twig

this code:

{{ view.field.ANOTHER-FIELD-NAME.original_value }}

It's works, but what if another field have option
Override the output of this field with custom text.
 

How to get this custom text in 
views-view-field-VIEW-NAME--DISPLAY-NAME--FIELD-NAME.html.twig
?

Comments

vasyok’s picture

For example i rewrite title field with "some text" value.

in /admin/config/development/settings
Twig development mode - should be ON

in views-view-field-VIEW-NAME--DISPLAY-NAME--FIELD-NAME.html.twig
should be  string

<pre>{{ dump(view.field) }}</pre>

Then title field will looks like (Oh thanks drupal.org there is impossible upload images in forum popst, so imsge black area with words) 

To find rewrited value need to move cursor on this black area, press Ctrl+F and paste Some text

and you can fiend something like:

0 array:2 [▼
  "title" => Drupal\views\Plugin\views\field\EntityField {#12772 ▼
    #pluginId: "field"
    #pluginDefinition: array:4 [▶]
    #configuration: array:7 [▶]
    #stringTranslation: null
    #_serviceIds: []
    #_entityStorages: []
    #messenger: null
    +options: array:37 [▼
      "id" => "title"
      "table" => "node_field_data"
      "field" => "title"
      "relationship" => "none"
      "group_type" => "group"
      "admin_label" => ""
      "label" => ""
      "exclude" => true
      "alter" => array:26 [▼
        "alter_text" => true
        "text" => "some text

So value of overrided field is 
{{ view.field.title.options.alter.text }}