Jump to content

Module Inputfield: how to check if the field currently is used on a repeater item?


horst
 Share

Recommended Posts

Hey, I know I used it already somewhere but can not remember / find it now. ?

Within an Inputfield in a PageEditor, it can be important to detect if the inputfield is on the base page or on a repeater item.

Exactly I need to get the precise name of the field. For example if a user named his field foo, I can get the name by calling $this->hasField->name from within my inputfield module. When the field is on a repeater, its final name is not foo but foo_repeater1234. That's what I'm after.

What method(s) can help me to get this from within the inpufield module?

Link to comment
Share on other sites

I think what you're looking for is the "name" attribute. So if $inputfield is an Inputfield object:

$inputfield->name // The name of the input element within the form, which has a suffix when inside a repeater
$inputfield->hasField->name // The name of the corresponding field (if the inputfield is associated with a field)

 

Link to comment
Share on other sites

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...