MDL-86454 badges: Hide revoke button if not available

This commit is contained in:
Stefan Hanauska
2025-08-27 10:09:13 +02:00
parent 5764f8ee38
commit 2c021bd81e
+8 -3
View File
@@ -151,12 +151,17 @@ class core_badges_renderer extends plugin_renderer_base {
'value' => $this->output->larrow() . ' ' . get_string('award', 'badges'),
'class' => 'actionbutton btn btn-secondary')
);
$actioncell->text .= html_writer::empty_tag('input', array(
if (has_capability('moodle/badges:revokebadge', $this->page->context)) {
$actioncell->text .= html_writer::empty_tag(
'input',
[
'type' => 'submit',
'name' => 'revoke',
'value' => get_string('revoke', 'badges') . ' ' . $this->output->rarrow(),
'class' => 'actionbutton btn btn-secondary')
);
'class' => 'actionbutton btn btn-secondary',
]
);
}
$actioncell->text .= html_writer::end_tag('div', array());
$actioncell->attributes['class'] = 'actions';
$potentialcell = new html_table_cell();