Jump to content

Show on frontside field label from template override


OLSA
 Share

Recommended Posts

I assume that you know how to show field label on front (there is few options), one option is:

echo $page->fields->summary->label; // for field with name "summary"

But today I had a problem how to show field label depending on the current page template (example: in template "member", "summary" field label is override to "Personal info"). In that case, previous example will not give you desired result.

To get field label in that case, this is what works:

$page->getField('summary')->label; // result would be "Personal info"

Maybe this is helpful for someone.

Regards.



  • Like 3
Link to comment
Share on other sites

  • 5 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...