ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
Button.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2016 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 
6 
7 use ILIAS\UI\Component as C;
11 
15 abstract class Button implements C\Button\Button {
16  use ComponentHelper;
18 
22  protected $label;
23 
27  protected $action;
28 
32  protected $active = true;
33 
34  public function __construct($label, $action) {
35  $this->checkStringArg("label", $label);
36  $this->checkStringArg("action", $action);
37  $this->label = $label;
38  $this->action = $action;
39  }
40 
44  public function getLabel() {
45  return $this->label;
46  }
47 
51  public function withLabel($label) {
52  $this->checkStringArg("label", $label);
53  $clone = clone $this;
54  $clone->label = $label;
55  return $clone;
56  }
57 
61  public function getAction() {
62  return $this->action;
63  }
64 
68  public function isActive() {
69  return $this->active;
70  }
71 
75  public function withUnavailableAction() {
76  $clone = clone $this;
77  $clone->active = false;
78  return $clone;
79  }
80 }
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
This implements commonalities between standard and primary buttons.
Definition: Button.php:15