How do we pass php code as a twig variable in global custom text field of views How can we pass this php code as a twig variable in global custom text in views without using views php module? 

I have created a view of news content with masonary layout .

&lt;?php
$language = \Drupal::languageManager()-&gt;getCurrentLanguage()-&gt;getId();
$alias = \Drupal::service('path.alias_manager')-&gt;getAliasByPath('/node /'.$row-&gt;nid);
echo $language.$alias;
?&gt;


I just want to render it as a twig variable in custom text field of views without creating template because i have already created a page long ago i dont want to rework by creating template.
To place PHP code in a field extend a field plugin and override render(). But in your case you should get the result of this code from the existing EntityLink plugin (in UI "Link to Content") and the option output_url_as_text. If you want to use it as Twig variable in another field, hide the entity link field from display and place it in front of the other field.