Button.php 433 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace Dcat\Admin\Form\Field;
  3. use Dcat\Admin\Form\Field;
  4. class Button extends Field
  5. {
  6. protected $class = 'btn-primary';
  7. public function info()
  8. {
  9. $this->class = 'btn-info';
  10. return $this;
  11. }
  12. public function on($event, $callback)
  13. {
  14. $this->script = <<<JS
  15. $('{$this->getElementClassSelector()}').on('$event', function() {
  16. $callback
  17. });
  18. JS;
  19. }
  20. }