Jump to content

Recommended Posts

Posted

I'm coding my first module now. I've just managed to add a button to the page edit form but am not content with its placing. Is there any way to place it just next to the input field? I've marked the desired place with the arrow on the attached screenshot.

My current code:

$this->addHookAfter('ProcessPageEdit::buildFormContent' , $this, 'addButton');

public function addButton($event){

$form = $event->return;

$f =$this->modules->InputfieldSubmit;

...

$form->insertAfter($f, $form->get("bgg_id"));

}

"bgg_id" is the name of the targeted field.

 

Screenshot_2018-07-31-01-18-44.jpg

Posted

Hook it in your in the inputfield's render's method:

 $this->addHookAfter('InputfieldText::render', $this, 'addButton');

In the addButton method, check for the field's name, so it doesn't render everywhere.

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
×
×
  • Create New...