mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-65928 core: Render master element as button too
This commit is contained in:
parent
6259a9d065
commit
5943fc3f95
4 changed files with 60 additions and 27 deletions
|
@ -48,6 +48,9 @@ class checkbox_toggleall implements renderable, templatable {
|
|||
/** @var array $options The options for the checkbox. */
|
||||
protected $options;
|
||||
|
||||
/** @var bool $isbutton Whether to render this as a button. Applies to master checkboxes only. */
|
||||
protected $isbutton;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -67,11 +70,13 @@ class checkbox_toggleall implements renderable, templatable {
|
|||
* <li><b>deselectall </b> string - Master only. The language string that will be used to indicate that clicking on
|
||||
* the master will select all of the slave checkboxes. Defaults to "Deselect all".</li>
|
||||
* </ul>
|
||||
* @param bool $isbutton Whether to render this as a button. Applies to master only.
|
||||
*/
|
||||
public function __construct(string $togglegroup, bool $ismaster, $options = []) {
|
||||
public function __construct(string $togglegroup, bool $ismaster, $options = [], $isbutton = false) {
|
||||
$this->togglegroup = $togglegroup;
|
||||
$this->ismaster = $ismaster;
|
||||
$this->options = $options;
|
||||
$this->isbutton = $ismaster && $isbutton;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -98,6 +103,8 @@ class checkbox_toggleall implements renderable, templatable {
|
|||
$data->deselectall = $this->options['deselectall'] ?? get_string('deselectall');
|
||||
}
|
||||
|
||||
$data->isbutton = $this->isbutton;
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue