Jump to content
bernhard

[solved] How to remove dropdown items from submit button?

Recommended Posts

Found the solution 🙂 

/**
 * Modify submit button on doc-import pages
 */
$wire->addHookAfter('ProcessPageEdit::getSubmitActions', function(HookEvent $event) {
  $page = $this->pages->get($this->input->get('id'));
  if(!$page->id OR !$page->template == 'docimport') return;
  $event->return = [];
});
$wire->addHookAfter("ProcessPageEdit::buildForm", function(HookEvent $event) {
  $form = $event->arguments(0);
  $page = $this->pages->get($this->input->get('id'));
  if(!$page->id OR !$page->template == 'docimport') return;
  $s = $form->getChildByName('submit_save');
  $s->value = 'Import starten';
  $s->icon = 'download';
});

rjH8kod.png

🙂 

Does anybody know how I can remove the dropdown items from the page edit submit_save button? As I didn't find a solution quickly I wanted to replace the button entirely, but this results in the following markup:

$wire->addHookAfter('ProcessPageEdit::buildForm', function(HookEvent $event) {
  $form = $event->arguments(0); /** @var InputfieldForm $form */
  $s = $form->getChildByName('submit_save'); /** @var InputfieldSubmit $s */
  $form->remove($s);
});

This hook results in this output:

5ARFpxm.png

I could hide this markup via CSS but I'd prefer a clean solution 🙂 

Thx!

  • Like 2

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