Skip to content

Commit

Permalink
Fix hide button feature
Browse files Browse the repository at this point in the history
  • Loading branch information
mouneyrac committed Nov 6, 2015
1 parent dd48a79 commit 3dfe5f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@ public function loginpage_hook() {
$content = str_replace(array("\n", "\r"), array("\\\n", "\\\r"), auth_googleoauth2_display_buttons(false));

$PAGE->requires->css('/auth/googleoauth2/bower_components/font-awesome/css/font-awesome.css');
// $PAGE->requires->css('/auth/googleoauth2/bower_components/bootstrap-social/bootstrap-social.css');
$PAGE->requires->css('/auth/googleoauth2/style.css');
$PAGE->requires->js_init_code("buttonsCodeOauth2 = '$content';");
$PAGE->requires->js(new moodle_url($CFG->wwwroot . "/auth/googleoauth2/script.js"));
Expand Down
12 changes: 7 additions & 5 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function googleoauth2_html_button($authurl, $providerdisplaystyle, $provider) {
} else if ($fontawesome == 'battlenet') {
$fontawesome = 'trophy';
}
return '<a href="' . $authurl . '" class="btn btn-block btn-social btn-' . $provider->sskstyle . '">'
return '<a href="' . $authurl . '" class="btn btn-block btn-social btn-' . $provider->sskstyle . '" style="' . $providerdisplaystyle . '" >'
. get_string('auth_sign-in_with', 'auth_googleoauth2', array('providername' => $provider->readablename))
. '<span class="fa fa-' . $fontawesome . '"></span></a>';
}
Expand Down Expand Up @@ -157,10 +157,12 @@ function auth_googleoauth2_render_buttons() {
set_state_token($providername, $provider->state);

// Check if we should display the button.
$providerisenabled = $provider->isenabled();
$providerscount = $providerisenabled ? $providerscount + 1 : $providerscount;
$displayprovider = ((empty($authprovider) || $authprovider == $providername || $allauthproviders) && $providerisenabled);
$providerdisplaystyle = $displayprovider ? 'display:inline-block;padding:10px;' : 'display:none;';
$displayprovider = $provider->isenabled();
$providerscount = $displayprovider ? $providerscount + 1 : $providerscount;
if ($displayprovider) {
$displayprovider = (empty($authprovider) || ($authprovider == $providername) || $allauthproviders);
}
$providerdisplaystyle = $displayprovider ? 'display:inline-block;' : 'display:none;';

// The button html code.
$html .= $provider->html_button($authurl, $providerdisplaystyle);
Expand Down

0 comments on commit 3dfe5f4

Please sign in to comment.