Index: i18n_access.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/i18n_access/i18n_access.module,v retrieving revision 1.2 diff -u -r1.2 i18n_access.module --- i18n_access.module 2 Feb 2009 16:50:16 -0000 1.2 +++ i18n_access.module 20 Feb 2009 14:54:53 -0000 @@ -61,6 +61,10 @@ $perms[$uid] = array(); } } + // adding the default languages if permission has been granted + if (user_access('access default languages')) { + $perms[$uid] = array_merge($perms[$uid], drupal_map_assoc(variable_get('i18n_access_languages', array()))); + } return $perms[$uid]; } @@ -181,7 +185,44 @@ } +/** + * Implementation of hook_perm() + */ +function i18n_access_perm() { + return array('access default languages'); +} +/** + * Implementation of hook_menu() + */ +function i18n_access_menu() { + $items = array(); + + $items['admin/settings/language/access'] = array( + 'title' => t('Access'), + 'page callback' => 'drupal_get_form', + 'page arguments' => array('i18n_access_admin_settings'), + 'access arguments' => array('administer site configuration'), + 'type' => MENU_LOCAL_TASK, + 'weight' => 10, + ); + return $items; +} +/** + * Admin settings form + */ +function i18n_access_admin_settings() { + + $form['i18n_access_languages'] = array( + '#title' => t('Select the default access languages'), + '#type' => 'select', + '#multiple' => 'true', + '#options' => array(I18N_ACCESS_LANGUAGE_NEUTRAL => t('Language neutral')) + locale_language_list('name'), + '#default_value' => variable_get('i18n_access_languages', array()), + '#description' => t("The selected languages are passed on to the 'access default languages' permission.") + ); + return system_settings_form($form); +} \ No newline at end of file