1<?php 2 3/* Copyright (c) 2015 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */ 4 5namespace ILIAS\UI\Component\Button; 6 7use ILIAS\UI\Component\Clickable; 8use ILIAS\UI\Component\Component; 9use ILIAS\UI\Component\Hoverable; 10use ILIAS\UI\Component\JavaScriptBindable; 11use ILIAS\UI\Component\Signal; 12 13/** 14 * This describes commonalities between standard and primary buttons. 15 */ 16interface Button extends Component, JavaScriptBindable, Clickable, Hoverable 17{ 18 /** 19 * Get the label on the button. 20 * 21 * @return string 22 */ 23 public function getLabel(); 24 25 /** 26 * Get a button like this, but with an additional/replaced label. 27 * 28 * @param string $label 29 * @return Button 30 */ 31 public function withLabel($label); 32 33 /** 34 * Get the action of the button, i.e. an URL that the button links to or 35 * some signals the button triggers on click. 36 * 37 * @return string|(Signal[]) 38 */ 39 public function getAction(); 40 41 /** 42 * Get to know if the button is activated. 43 * 44 * @return bool 45 */ 46 public function isActive(); 47 48 /** 49 * Get a button like this, but action should be unavailable atm. 50 * 51 * The button will still have an action afterwards, this might be usefull 52 * at some point where we want to reactivate the button client side. 53 * 54 * @return Button 55 */ 56 public function withUnavailableAction(); 57 58 /** 59 * Get a button like this, but with an additional/replaced aria-label. 60 * 61 * @param string $aria_label 62 * @return Button 63 */ 64 public function withAriaLabel($aria_label); 65 66 /** 67 * Get the aria-label on the button. 68 * 69 * @return string 70 */ 71 public function getAriaLabel(); 72 73 /** 74 * @inheritdocs 75 * 76 * This will also remove a string action if there currently is one. 77 */ 78 public function withOnClick(Signal $signal); 79} 80