Correct composer require command for Better buttons in SS4+

Silverstripe Version:

4.2.1

Question:

I read on the Better Buttons repo that to use BetterButtons in SS4 right now, then I should use this branch:

dev-feature/ss4-upgrade

Can anyone advise the correct way to include this branch via composer?

I tried something like this:
composer require unclecheese/silverstripe-gridfield-betterbuttons:dev-feature/ss4-upgrade

but I can’t seem to get the syntax right.

Thanks!

Try below command

composer require unclecheese/betterbuttons:dev-feature/ss4-upgrade

Hope it helps you.

Thanks!

Note that the ss4-upgrade branch does not seem to be fully compatible with SS 4.2. (I haven’t tested with 4.0 or 4.1). Composer is able to install it, but you will run into some PHP errors.

I got at least this error when going to view the edit page of a DataObject which uses better button custom actions:

PHP Fatal error:  Call to a member function Link() on null in *website root path here*/betterbuttons/src/Actions/CustomAction.php on line 132.

To install that upgrade would be the only way to get the next/prev and add button applied to the detailsform?

I’ve just tried this on my SS4.2.2 upgrade project that’s almost finished. It broke basic editing of all DataObjects sadly looking for “isPublished”. Took it back out again.

I was waiting for it to go into core anyway but thought I’d give it a bash as I only really want the next / previous buttons.

It is coming soon. Hopefully in 4.3. Looking forward to that.

I had the same problem with ‘betterbuttons’ calling the missing ‘isPublished()’ method. I put this method in all my DataObject classes:

public function isPublished()
{
    return $this->exists();
}

Not neat at all, but at least works. Although I ran into some other problems with my custom action buttons, which I had to take out. But at least the ‘previous’ and ‘next’ buttons are working well.

I’m using SS3.4 and still same problem with “isPublished”

@Taitava Adding the isPublished() method in every DataObject as you say, has worked for me :slight_smile:

Thank you!

You are welcome! :slight_smile:
Just to mention, I’ve experinced a few more issues with betterbuttons in SS4 (buttons that don’t do anything at least), so I’ve ended up removing betterbuttons completely in one of my projects.

There is some discussion about mergin the betterbuttons module to core: Prev, Next and Create buttons on detail GridField forms · Issue #436 · silverstripe/silverstripe-admin · GitHub

I didn’t read that discussion as I don’t have time now, but at least it looks promising.

Edit: Whoops, this reply was meant for @sirjeffy . And the merging discussion is of course only applicable to SS4.x, so perhaps you’ll need to upgrade to 4 at some point :)).

Yes it looks like it has been fixed but not released??

So I grabbed the code for the delete button from here:

and added that which fixed the issue completely (from what I can see so far). The same error was happening with the Security Groups and Users - assuming anything with a delete button.