Jump to content
Sevarf2

Add extra markup to an inputfield

Recommended Posts

I'd like to add extra markup to a specific inputfield text in the admin using a module, I tried an hook like this but pw says the method doesn't exist
 

$this->addHookBefore('Inputfield::render', $this, "addMarkup");

 
protected function addMarkup($event){
    $Inputfield = $event->object;
    if($Inputfield->attr('name') == "myfieldname"){
         
        $Inputfield->setMarkup([
            'item_content' => "my markup"
        ]);
           
    }
}


Share this post


Link to post
Share on other sites

If you hook the render() method, the $event->return contains the markup. Therefore you need to modify $event->return to modify the markup:

Tpb5ZCW.png

  • Like 3

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...