How to add button in collection sidebar?

Hi there!

I have a collection named Order ( online shopping )
I’d like to add some buttons in the collection entry sidebar, this button simply changes the entry status and then save it.

I’m thinking to override the entry view and then found out about :


What does it do?
can it be used for my scenario?
How to change the entry value on button click and then save it?

It fires the event collections.entry.aside.

You can add content via /config/bootstrap.php with

$app->on('collections.entry.aside', function() {
    echo '<p style="border:4px solid red">add button here</p>';

or cleaner:

$app->on('collections.entry.aside', function() {
    $text = 'Test';
    $button = 'Change';

    $this->renderView($this->path('pluginname:views/partials/add_button.php'), compact('text', 'button'));

add_button.php should contain something like this (not tested):

<!-- Lexy templating with double curly brackets - output: <?php echo $text; ?> -->
<p>{{ $text }}</p>

<!-- riot.js with single curly brackets in onclick event -->
<button class="uk-button uk-button-large" value="buttonvalue" onclick="{ changeEntryAndSave }">

    <!-- Lexy templating again -->
    {{ $button }}



    changeEntryAndSave = function(e) {

        if (e) e.preventDefault();

        $this.entry.status = 'Shipping';





PS: You can use markdown syntax highlighting on discourse by using backticks. It makes code more readable and it prevents copy/paste issues with wrong quotation.