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
8use ILIAS\UI\Implementation\Component\ComponentHelper;
11
15abstract 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}
An exception for terminatinating execution or to throw for unit testing.
This implements commonalities between standard and primary buttons.
Definition: Button.php:15
This describes how a glyph could be modified during construction of UI.
Definition: Glyph.php:12
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.