summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Berezovsky2013-02-10 13:51:31 (GMT)
committer Andrew Berezovsky2013-02-10 13:51:31 (GMT)
commit8dc4c40a0f4a9eb7dba0a7b90130fef04f61aca2 (patch)
tree0029f4999d08ad72bf1257fbdf9834026b54a40b
parentf1e0a272fd9ebf622a241457125496a4b60dc18f (diff)
Implemented [#1911580] - added availability column to providers table
-rw-r--r--hybridauth.admin.inc5
-rw-r--r--hybridauth.module16
2 files changed, 17 insertions, 4 deletions
diff --git a/hybridauth.admin.inc b/hybridauth.admin.inc
index 9bfc28e..97e76a5 100644
--- a/hybridauth.admin.inc
+++ b/hybridauth.admin.inc
@@ -35,6 +35,9 @@ function hybridauth_admin_settings() {
'#title' => drupal_placeholder($provider_name),
'#default_value' => variable_get('hybridauth_provider_' . $provider_id . '_enabled', 0),
);
+ $form['vtabs']['fset_providers'][$provider_id]['file'] = array(
+ '#markup' => array_key_exists($provider_id, hybridauth_providers_files()) ? t('Yes') : t('No'),
+ );
$form['vtabs']['fset_providers'][$provider_id]['hybridauth_provider_' . $provider_id . '_weight'] = array(
'#type' => 'weight',
//'#title' => t('Weight'),
@@ -312,6 +315,7 @@ function theme_hybridauth_admin_settings_providers_table($vars) {
$header = array(
array('data' => t('Name'), 'colspan' => 2),
+ t('Available'),
t('Weight'),
t('Operations'),
);
@@ -322,6 +326,7 @@ function theme_hybridauth_admin_settings_providers_table($vars) {
$row = array(
drupal_render($form[$provider_id]['hybridauth_provider_' . $provider_id . '_enabled']),
drupal_render($form[$provider_id]['icon']),
+ drupal_render($form[$provider_id]['file']),
drupal_render($form[$provider_id]['hybridauth_provider_' . $provider_id . '_weight']),
drupal_render($form[$provider_id]['settings']),
);
diff --git a/hybridauth.module b/hybridauth.module
index cf28d8b..8fe6b40 100644
--- a/hybridauth.module
+++ b/hybridauth.module
@@ -201,7 +201,7 @@ function _hybridauth_form_alter(&$form, &$form_state, $form_id) {
*/
function hybridauth_form_user_profile_form_alter(&$form, &$form_state, $form_id) {
//global $user;
- if ($form['#user_category'] == 'account' &&!empty($form['#user']->data['hybridauth'])) {
+ if ($form['#user_category'] == 'account' && !empty($form['#user']->data['hybridauth'])) {
if ($form['account']['name']['#access'] && variable_get('hybridauth_disable_username_change', 1)) {
$form['account']['name']['#access'] = FALSE;
}
@@ -396,9 +396,9 @@ function hybridauth_providers_list() {
'Vkontakte' => t('VKontakte'),
'Yandex' => t('Yandex'),
);
- foreach (file_scan_directory(_hybridauth_library_path() . '/Hybrid/Providers', '/\.php$/') as $file) {
- if (!array_key_exists($file->name, $raw_providers)) {
- $raw_providers[$file->name] = $file->name;
+ foreach (hybridauth_providers_files() as $name => $file) {
+ if (!array_key_exists($name, $raw_providers)) {
+ $raw_providers[$name] = $name;
}
}
@@ -418,6 +418,14 @@ function hybridauth_providers_list() {
return $providers;
}
+function hybridauth_providers_files() {
+ static $files;
+ if (!isset($files)) {
+ $files = file_scan_directory(_hybridauth_library_path() . '/Hybrid/Providers', '/\.php$/', array('key' => 'name'));
+ }
+ return $files;
+}
+
function hybridauth_fields_list() {
return array(
'provider' => t('Authentication provider'),