how to create a button in php code example
Example: buttons in php
class StargazerButton extends \atk4\ui\Button {
public $model;
public $label;
function init() {
parent::init();
$this->add(new Button(['Stars', 'basic blue', 'icon'=>'star']));
$this->label = $this->add(new Label($model['stars'], ['basic blue left pointing']));
$this->on('click', function() {
$this->model['stars']++;
$this->model->save();
return $this->reload();
});
}
}