Correct composer require command for Better buttons in SS4+


#1

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!


#2

Try below command

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

Hope it helps you.

Thanks!


#3

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.

#4

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


#5

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.


#6

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.