I'm having a hard time trying declaring more variables for this module.
I already did that for the #2158305: Variable support to translate widget title issue, but I can't figure out the nature/type of the variable for hybridauth_provider_LinkedIn_enabled for instance.

Any luck out there ?

EDIT: This is helpful when you are using Domain Access, and when - after assigning this declared variable to a Domain realm variable - you can then enable by domain, matching only some providers with some domains.

Comments

pedrosp’s picture

Issue summary: View changes
pedrosp’s picture

Version: 7.x-2.9 » 7.x-2.10

I managed with Hybridauth 2.9 to declare variables in a custom module, not in a fancy way, but fair enough to solve my problem of using different configurations of hybridauth when using Domain Access (aka several domains). It was all like this:

function MYMODULE_variable_info($options = array()) {
  $variables['hybridauth_provider_Facebook_enabled'] = array(
    'title' => t('Facebook enabled', array(), $options),
    'description' => t('Is facebook enabled', array(), $options),
    'type' => 'number',
    'default' => 0,
    'group' => 'hybridauth',
    'multidomain' => TRUE,
  );
  $variables['hybridauth_provider_Facebook_keys_id'] = array(
    'title' => t('Facebook key ID', array(), $options),
    'description' => t('Facebook key ID', array(), $options),
    'type' => 'string',
    'default' => NULL,
    'group' => 'hybridauth_facebook',
    'multidomain' => TRUE,
  );
  $variables['hybridauth_provider_Facebook_keys_secret'] = array(
    'title' => t('Facebook key secret', array(), $options),
    'description' => t('Facebook key secret', array(), $options),
    'type' => 'string',
    'default' => NULL,
    'group' => 'hybridauth_facebook',
    'multidomain' => TRUE,
  );
  $variables['hybridauth_provider_Google_enabled'] = array(
    'title' => t('Google enabled', array(), $options),
    'description' => t('Is Google enabled', array(), $options),
    'type' => 'number',
    'default' => 0,
    'group' => 'hybridauth',
    'multidomain' => TRUE,
  );
  $variables['hybridauth_provider_Google_keys_id'] = array(
    'title' => t('Google key ID', array(), $options),
    'description' => t('Google key ID', array(), $options),
    'type' => 'string',
    'default' => NULL,
    'group' => 'hybridauth_google',
    'multidomain' => TRUE,
  );
  $variables['hybridauth_provider_Google_keys_secret'] = array(
    'title' => t('Google key secret', array(), $options),
    'description' => t('Google key secret', array(), $options),
    'type' => 'string',
    'default' => NULL,
    'group' => 'hybridauth_google',
    'multidomain' => TRUE, 
  );
 // and so on with every provider I want to manage
  return $variables;
}

/**
 * Implements hook_variable_group_info().
 */
function MYMODULE_variable_group_info() {
  $groups['hybridauth'] = array(
    'title' => t('HybridAuth'),
    'description' => t('Oauth variables.'),
    'access' => 'administer domains',
    'path' => array('admin/config/people/hybridauth'),
  );
  $groups['hybridauth_facebook'] = array(
    'title' => t('HybridAuth Facebook'),
    'description' => t('Oauth variables.'),
    'access' => 'administer domains',
    'path' => array('admin/config/people/hybridauth/provider/Facebook'),
  );
  $groups['hybridauth_google'] = array(
    'title' => t('HybridAuth Google'),
    'description' => t('Oauth variables.'),
    'access' => 'administer domains',
    'path' => array('admin/config/people/hybridauth/provider/Google'),
  );
 // and so on with every provider I want to manage
  return $groups;
}

However with the new 2.10 version and #2303237: Remove plenty of variables new "enhancement" I'm screwed again :(
Since the "enabled" is now embedded in an array, I'm not able to declare the array variable and save independent values for each domain.
I have tried to use something like this but it ain't worked.

  $variables['hybridauth_providers'] = array(
    'title' => t('Hybridauth Providers', array(), $options),
    'description' => t('is providers enabled', array(), $options),
    'type' => 'array',
    'default' => array(),
    'group' => 'hybridauth',
    'multidomain' => TRUE,
  );

I could then declare the variable in a domain realm, but neither

  • admin/config/people/hybridauth show the domain selector,
  • or admin/structure/domain/view/3/variables allow to input any value

Any clue please ?

duozersk’s picture

pedrosp,

The issue is that the settings form doesn't use the 'hybridauth_providers' variable directly and so the Variable module can't detect its usage (at least this is what I assume).
We need to understand how Variable module changes the variable_get() calls so that it returns different values for different domains. Then we probably would need to code another settings form (modify the existing one) so that it saves the values per domain.

Thanks
AndyB

sano’s picture

Issue summary: View changes

edits to the issue description, that hopefully make more clear its meaning to the readers.