Jump to content

validating inputfield settings from input tab


owzim
 Share

Recommended Posts

I have a Module, which is an InputField, I have some custom settings, which is accessible via the input tab on the field edit page. I want to validate the settings given by the user.

What I have so far (like suggested here):

$this->addHookAfter('InputField::processInput', $this, 'HookValidateSettingsInput');
public function HookValidateSettingsInput(HookEvent $event){
    
    $inputfield = $event->object;
    
    // unsafe because there can be other fields with that name on other templates
    // and this hook would trigger there as well
    if ($inputfield->name == "nameOfTheInputField") {
        // do stuff
    }
}

But this is totally unsafe.

How can I check if the currently processed inputfield (which is a text area in this case) belongs to the InputFiled settings of my module.

I can't find any reference within the $event->object, just a bunch of input field wrappers with numbers.

Thanks.

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