LAPS Posted November 26, 2018 Share Posted November 26, 2018 Hi, I've a multi-language text field which label is overridden in the template to "Label English" and "Label Italian". I'd like to output the overridden Italian version when accessing the link http://www.website.com/it/. I tried the following without success: // output a blank value $page->text_field_name->label; $page->get('text_field_name')->label; // get the error: "Error: Call to a member function getLabel() on string" $page->text_field_name->getLabel(); $page->get('text_field_name')->getLabel(); // output the not overridden, translated value $page->fields->text_field_name->label; $page->fields->text_field_name->getLabel(); $page->fields->get('text_field_name')->label; $page->fields->get('text_field_name')->getLabel(); How can I output the label overridden in the template? Update I ended up using: $page->fields->getFieldContext('text_field_name')->getLabel(); Is it the correct way to get the overridden, translated label? Or is there some better? 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now