<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://sugarclub.sugarcrm.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Get field label in PHP</title><link>https://sugarclub.sugarcrm.com/dev-club/f/questions-answers/6146/get-field-label-in-php</link><description>Hi, 
 In a custom component I need to display a field label. According to the documentation I can use the &amp;quot;translate&amp;quot; function. https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_12.1/Architecture/Languages/Module_Labels</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Get field label in PHP</title><link>https://sugarclub.sugarcrm.com/thread/28019?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2023 14:46:10 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:9f72589c-0c7d-4915-9ee7-82fea5fd2cf9</guid><dc:creator>Francesca Shiekh</dc:creator><description>&lt;p&gt;Opps! I missed that. You are right!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get field label in PHP</title><link>https://sugarclub.sugarcrm.com/thread/28018?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2023 14:29:44 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:6ad440dc-d3a0-45fb-a58b-03c02c5b7915</guid><dc:creator>Stijn Vermeulen</dc:creator><description>&lt;p&gt;Hi Francesca,&lt;/p&gt;
&lt;p&gt;Thanks for your reply, but how to get the &amp;quot;LBL_THE_LABEL&amp;quot; in a var this way? I don&amp;#39;t know the name of the label.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get field label in PHP</title><link>https://sugarclub.sugarcrm.com/thread/28017?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2023 14:26:59 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:b2522e9e-110d-4ff9-87b0-759f383fec9a</guid><dc:creator>Francesca Shiekh</dc:creator><description>&lt;p&gt;You can use app_strings without having to load the whole bean:&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="php"&gt;global $app_strings;
$label = isset($app_strings[&amp;#39;LBL_THE_LABEL&amp;#39;]) ? $app_strings[&amp;#39;LBL_THE_LABEL&amp;#39;] : &amp;quot;default_label&amp;quot;;
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get field label in PHP</title><link>https://sugarclub.sugarcrm.com/thread/28015?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2023 13:45:44 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:754ada42-7c41-47c8-8979-e1af29113916</guid><dc:creator>Stijn Vermeulen</dc:creator><description>&lt;p&gt;Ok, I figured it out by searching the sugar core php files.&lt;/p&gt;
&lt;p&gt;$emptyBean = BeanFactory::newBean($module);&lt;br /&gt;$labelKey = $emptyBean-&amp;gt;field_defs[$fieldName]['vname'];&lt;br /&gt;$label = translate($labelKey, $module);&lt;/p&gt;
&lt;p&gt;Hope some one else finds it useful.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>