locale.views.inc

  1. 3.x modules/locale.views.inc
  2. 2.x modules/locale.views.inc

Provides views data and handlers for locale.module.

File

modules/locale.views.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. *
  5. * Provides views data and handlers for locale.module.
  6. */
  7. /**
  8. * @defgroup views_locale_module locale.module handlers
  9. *
  10. * @{
  11. */
  12. /**
  13. * Implementation of hook_views_data().
  14. */
  15. function locale_views_data() {
  16. // Basic table information.
  17. // Define the base group of this table.
  18. $data['locales_source']['table']['group'] = t('Locale source');
  19. // Advertise this table as a possible base table.
  20. $data['locales_source']['table']['base'] = array(
  21. 'field' => 'lid',
  22. 'title' => t('Locale source'),
  23. 'help' => t('A source string for translation, in English or the default site language.'),
  24. );
  25. // lid
  26. $data['locales_source']['lid'] = array(
  27. 'title' => t('LID'),
  28. 'help' => t('The ID of the source string.'),
  29. 'field' => array(
  30. 'handler' => 'views_handler_field',
  31. 'click sortable' => TRUE,
  32. ),
  33. 'argument' => array(
  34. 'handler' => 'views_handler_argument_numeric',
  35. 'numeric' => TRUE,
  36. 'validate type' => 'lid',
  37. ),
  38. 'filter' => array(
  39. 'handler' => 'views_handler_filter_numeric',
  40. ),
  41. 'sort' => array(
  42. 'handler' => 'views_handler_sort',
  43. ),
  44. );
  45. // location
  46. $data['locales_source']['location'] = array(
  47. 'group' => t('Locale source'),
  48. 'title' => t('Location'),
  49. 'help' => t('A description of the location or context of the string.'),
  50. 'field' => array(
  51. 'handler' => 'views_handler_field',
  52. 'click sortable' => TRUE,
  53. ),
  54. 'sort' => array(
  55. 'handler' => 'views_handler_sort',
  56. ),
  57. 'filter' => array(
  58. 'handler' => 'views_handler_filter_string',
  59. ),
  60. 'argument' => array(
  61. 'handler' => 'views_handler_argument_string',
  62. ),
  63. );
  64. // Group field
  65. $data['locales_source']['textgroup'] = array(
  66. 'group' => t('Locale source'),
  67. 'title' => t('Group'),
  68. 'help' => t('The group the translation is in.'),
  69. 'field' => array(
  70. 'handler' => 'views_handler_field_locale_group',
  71. 'click sortable' => TRUE,
  72. ),
  73. 'filter' => array(
  74. 'handler' => 'views_handler_filter_locale_group',
  75. ),
  76. 'argument' => array(
  77. 'handler' => 'views_handler_argument_locale_group',
  78. ),
  79. );
  80. // Source field
  81. $data['locales_source']['source'] = array(
  82. 'group' => t('Locale source'),
  83. 'title' => t('Source'),
  84. 'help' => t('The full original string.'),
  85. 'field' => array(
  86. 'handler' => 'views_handler_field',
  87. ),
  88. 'filter' => array(
  89. 'handler' => 'views_handler_filter_string',
  90. ),
  91. );
  92. // Version field
  93. $data['locales_source']['version'] = array(
  94. 'group' => t('Locale source'),
  95. 'title' => t('Version'),
  96. 'help' => t('The version of Drupal core that this string is for.'),
  97. 'field' => array(
  98. 'handler' => 'views_handler_field',
  99. 'click sortable' => TRUE,
  100. ),
  101. 'filter' => array(
  102. 'handler' => 'views_handler_filter_locale_version',
  103. ),
  104. 'argument' => array(
  105. 'handler' => 'views_handler_argument_string',
  106. ),
  107. );
  108. $data['locales_source']['edit_lid'] = array(
  109. 'group' => t('Locale source'),
  110. 'field' => array(
  111. 'title' => t('Edit link'),
  112. 'help' => t('Provide a simple link to edit the translations.'),
  113. 'handler' => 'views_handler_field_locale_link_edit',
  114. ),
  115. );
  116. // ----------------------------------------------------------------------
  117. // Locales target table
  118. // Define the base group of this table. Fields that don't
  119. // have a group defined will go into this field by default.
  120. $data['locales_target']['table']['group'] = t('Locale target');
  121. // Join information
  122. $data['locales_target']['table']['join'] = array(
  123. 'locales_source' => array(
  124. 'left_field' => 'lid',
  125. 'field' => 'lid',
  126. ),
  127. );
  128. // Translation field
  129. $data['locales_target']['translation'] = array(
  130. 'group' => t('Locale target'),
  131. 'title' => t('Translation'),
  132. 'help' => t('The full translation string.'),
  133. 'field' => array(
  134. 'handler' => 'views_handler_field',
  135. ),
  136. 'filter' => array(
  137. 'handler' => 'views_handler_filter_string',
  138. ),
  139. );
  140. // Language field
  141. $data['locales_target']['language'] = array(
  142. 'group' => t('Locale target'),
  143. 'title' => t('Language'),
  144. 'help' => t('The language this translation is in.'),
  145. 'field' => array(
  146. 'handler' => 'views_handler_field_locale_language',
  147. 'click sortable' => TRUE,
  148. ),
  149. 'filter' => array(
  150. 'handler' => 'views_handler_filter_locale_language',
  151. ),
  152. 'argument' => array(
  153. 'handler' => 'views_handler_argument_locale_language',
  154. ),
  155. );
  156. $data['locales_target']['plid'] = array(
  157. 'group' => t('Locale target'),
  158. 'title' => t('Singular LID'),
  159. 'help' => t('The ID of the parent translation.'),
  160. 'field' => array(
  161. 'handler' => 'views_handler_field',
  162. ),
  163. );
  164. // Plural
  165. $data['locales_target']['plural'] = array(
  166. 'group' => t('Locale target'),
  167. 'title' => t('Plural'),
  168. 'help' => t('Whether or not the translation is plural.'),
  169. 'field' => array(
  170. 'handler' => 'views_handler_field_boolean',
  171. 'click sortable' => TRUE,
  172. ),
  173. 'filter' => array(
  174. 'handler' => 'views_handler_filter_boolean_operator',
  175. 'label' => t('Plural'),
  176. 'type' => 'yes-no',
  177. ),
  178. 'sort' => array(
  179. 'handler' => 'views_handler_sort',
  180. ),
  181. );
  182. return $data;
  183. }
  184. /**
  185. * Implementation of hook_views_handlers().
  186. */
  187. function locale_views_handlers() {
  188. return array(
  189. 'info' => array(
  190. 'path' => drupal_get_path('module', 'views') . '/modules/locale',
  191. ),
  192. 'handlers' => array(
  193. // Field handlers.
  194. 'views_handler_field_locale_group' => array(
  195. 'parent' => 'views_handler_field',
  196. ),
  197. 'views_handler_field_locale_language' => array(
  198. 'parent' => 'views_handler_field',
  199. ),
  200. 'views_handler_field_locale_link_edit' => array(
  201. 'parent' => 'views_handler_field',
  202. ),
  203. // Argument handlers.
  204. 'views_handler_argument_locale_group' => array(
  205. 'parent' => 'views_handler_argument',
  206. ),
  207. 'views_handler_argument_locale_language' => array(
  208. 'parent' => 'views_handler_argument',
  209. ),
  210. // Filters.
  211. 'views_handler_filter_locale_group' => array(
  212. 'parent' => 'views_handler_filter_in_operator',
  213. ),
  214. 'views_handler_filter_locale_language' => array(
  215. 'parent' => 'views_handler_filter_in_operator',
  216. ),
  217. 'views_handler_filter_locale_version' => array(
  218. 'parent' => 'views_handler_filter_in_operator',
  219. ),
  220. ),
  221. );
  222. }
  223. /**
  224. * @}
  225. */