1. Go to this page and download the library: Download unclecheese/betterbuttons library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
unclecheese / betterbuttons example snippets
public function getBetterButtonsActions() {
$fields = parent::getBetterButtonsActions();
if($this->IsApproved) {
$fields->push(BetterButtonCustomAction::create('deny', 'Deny'));
}
else {
$fields->push(BetterButtonCustomAction::create('approve', 'Approve'));
}
return $fields;
}
public function approve() {
$this->IsApproved = true;
$this->write();
}
public function deny() {
$this->IsApproved = false;
$this->write();
}
public function deny() {
$this->IsApproved = false;
$this->write();
return 'Denied for publication';
}
$fields->push(
new BetterButtonLink(
'View on Meetup.com',
$this->MeetUpLink
)
);
public function getBetterButtonsActions() {
$f = parent::getBetterButtonsActions();
$f->push(BetterButtonNestedForm::create('sendmessage','Send this customer a message', FieldList::create(
TextareaField::create('Content')
)));
return $f;
}