MDL-74162 glossary: Fix the returned data type by create_add_button()

This commit is contained in:
Mihail Geshoski 2022-03-11 00:03:52 +08:00
parent 01eb6d2e9b
commit f6104220d6

View File

@ -153,11 +153,11 @@ class standard_action_bar implements renderable, templatable {
* Render the add entry button
*
* @param renderer_base $output
* @return \stdClass
* @return \stdClass|null
*/
private function create_add_button(renderer_base $output): \stdClass {
private function create_add_button(renderer_base $output): ?\stdClass {
if (!has_capability('mod/glossary:write', $this->context)) {
return '';
return null;
}
$btn = new single_button(new moodle_url('/mod/glossary/edit.php', ['cmid' => $this->cm->id]),
get_string('addsingleentry', 'glossary'), 'post', true);