How to get the values from a formatted field in inc file
How do I get the value without that , basic html part?


$node-&gt;field_name-&gt;value; should do the trick.




  I can resolve this in the twig file by getting this as {{fieldname|raw}}.


Using | raw filter in twig is bad security practice, see How do I get the raw field value in a twig template? for a safe solution.