translate_perms.module 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /**
  3. * @file
  4. * This is the file description for Translate Perms module.
  5. *
  6. * In this more verbose, multi-line description, you can specify what this
  7. * file does exactly. Make sure to wrap your documentation in column 78 so
  8. * that the file can be displayed nicely in default-sized consoles.
  9. */
  10. /**
  11. * Implements hook_permission().
  12. */
  13. function translate_perms_permission() {
  14. return array(
  15. 'access_translations_overview' => array(
  16. 'title' => t('Access translations overview')
  17. ),
  18. 'access_translation_table_fields' => array(
  19. 'title' => t('Access translation Fields table')
  20. ),
  21. 'access_translation_table_content_type' => array(
  22. 'title' => t('Access translation Content types table')
  23. ),
  24. 'access_translation_table_menu' => array(
  25. 'title' => t('Access translation menu table')
  26. ),
  27. 'access_translation_table_taxonomy' => array(
  28. 'title' => t('Access translation taxonomy table')
  29. ),
  30. 'translate_strings' => array(
  31. 'title' => t('Translate strings')
  32. ),
  33. 'import_translations' => array(
  34. 'title' => t('Import translations')
  35. ),
  36. 'refresh_strings' => array(
  37. 'title' => t('Refresh strings')
  38. ),
  39. 'update_modules_translations' => array(
  40. 'title' => t('Update modules translations')
  41. ),
  42. 'export_translations' => array(
  43. 'title' => t('Import translations')
  44. ),
  45. );
  46. }
  47. /**
  48. * Implements hook_menu_alter().
  49. */
  50. function translate_perms_menu_alter(&$items) {
  51. if(isset($items['admin/config/regional/translate']))
  52. $items['admin/config/regional/translate']['access arguments'] = array('access_translations_overview');
  53. if(isset($items['admin/config/regional/translate/table']))
  54. $items['admin/config/regional/translate/table']['access arguments'] = array('access_translation_table_fields');
  55. if(isset($items['admin/config/regional/translate/table/nodetype']))
  56. $items['admin/config/regional/translate/table/nodetype']['access arguments'] = array('access_translation_table_content_type');
  57. if(isset($items['admin/config/regional/translate/table/menu']))
  58. $items['admin/config/regional/translate/table/menu']['access arguments'] = array('access_translation_table_menu');
  59. if(isset($items['admin/config/regional/translate/table/taxonomy']))
  60. $items['admin/config/regional/translate/table/taxonomy']['access arguments'] = array('access_translation_table_taxonomy');
  61. if(isset($items['admin/config/regional/translate/translate']))
  62. $items['admin/config/regional/translate/translate']['access arguments'] = array('translate_strings');
  63. if(isset($items['admin/config/regional/translate/import']))
  64. $items['admin/config/regional/translate/import']['access arguments'] = array('import_translations');
  65. if(isset($items['admin/config/regional/translate/i18n_string']))
  66. $items['admin/config/regional/translate/i18n_string']['access arguments'] = array('refresh_strings');
  67. if(isset($items['admin/config/regional/translate/update']))
  68. $items['admin/config/regional/translate/update']['access arguments'] = array('update_modules_translations');
  69. if(isset($items['admin/config/regional/translate/export']))
  70. $items['admin/config/regional/translate/export']['access arguments'] = array('export_translations');
  71. }