Skip to content

Commit

Permalink
MDL-83239 tool_mfa: do not assign plugin renderer to $OUTPUT
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Wagner authored and PhMemmel committed Sep 23, 2024
1 parent da80258 commit 59aba66
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 0 additions & 2 deletions admin/tool/mfa/action.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
}

$PAGE->navbar->add(get_string('setupfactor', 'factor_'.$factor));
$OUTPUT = $PAGE->get_renderer('tool_mfa');
$form = new setup_factor_form($currenturl, ['factorname' => $factor]);

if ($form->is_submitted()) {
Expand Down Expand Up @@ -114,7 +113,6 @@
}

$PAGE->navbar->add(get_string('action:revoke', 'factor_'.$factor));
$OUTPUT = $PAGE->get_renderer('tool_mfa');

$revokeparams = [
'factorname' => $factorobject->get_display_name(),
Expand Down
8 changes: 4 additions & 4 deletions admin/tool/mfa/classes/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ public static function display_debug_notification(): void {
}

// Status.
$OUTPUT = $PAGE->get_renderer('tool_mfa');
$renderer = $PAGE->get_renderer('tool_mfa');
// If toggle has been flipped, fall to default pending badge.
if ($weighttoggle) {
$state = $OUTPUT->get_state_badge('');
$state = $renderer->get_state_badge('');
} else {
$state = $OUTPUT->get_state_badge($factor->get_state());
$state = $renderer->get_state_badge($factor->get_state());
}

$table->data[] = [
Expand All @@ -135,7 +135,7 @@ public static function display_debug_notification(): void {
'',
'<b>' . get_string('overall', 'tool_mfa') . '</b>',
self::get_cumulative_weight(),
$OUTPUT->get_state_badge($finalstate),
$renderer->get_state_badge($finalstate),
];

$html .= \html_writer::table($table);
Expand Down
7 changes: 3 additions & 4 deletions admin/tool/mfa/user_preferences.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
$PAGE->navbar->add($node->get_content(), $node->action());
}
$PAGE->navbar->add(get_string('preferences:header', 'tool_mfa'), new \moodle_url('/admin/tool/mfa/user_preferences.php'));
$OUTPUT = $PAGE->get_renderer('tool_mfa');
$renderer = $PAGE->get_renderer('tool_mfa');

echo $OUTPUT->header();
if (!empty($action)) {
Expand All @@ -58,10 +58,9 @@
}
}

echo $OUTPUT->active_factors();
echo $OUTPUT->available_factors();
echo $renderer->active_factors();
echo $renderer->available_factors();

$renderer = $PAGE->get_renderer('tool_mfa');
echo $renderer->get_support_link();

\tool_mfa\manager::display_debug_notification();
Expand Down

0 comments on commit 59aba66

Please sign in to comment.