tripal_ds.field_group.inc 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <?php
  2. /**
  3. * Implements hook_field_group_info().
  4. */
  5. function tripal_ds_overview_field_group_info($bundle_name, $fields){
  6. //fieldset field to nest the table within
  7. $field_group_fieldset = new stdClass();
  8. $field_group_fieldset->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  9. $field_group_fieldset->api_version = 1;
  10. $field_group_fieldset->identifier = 'group_summary|TripalEntity|'.$bundle_name.'|default';
  11. $field_group_fieldset->group_name = 'group_summary';
  12. $field_group_fieldset->entity_type = 'TripalEntity';
  13. $field_group_fieldset->bundle = $bundle_name;
  14. $field_group_fieldset->mode = 'default';
  15. $field_group_fieldset->parent_name = '';
  16. $field_group_fieldset->data = array(
  17. 'label' => 'Summary',
  18. 'weight' => '2',
  19. 'children' => array(
  20. 0 => 'group_summary_table',
  21. ),
  22. 'format_type' => 'fieldset',
  23. 'format_settings' => array(
  24. 'label' => 'Summary',
  25. 'instance_settings' => array(
  26. 'id' => '',
  27. 'classes' => 'group-summary field-group-fieldset',
  28. 'description' => '',
  29. ),
  30. 'formatter' => 'collapsible',
  31. ),
  32. );
  33. drupal_write_record('field_group', $field_group_fieldset);
  34. watchdog('debug', '<pre>summary_field_group_info $field_group_fieldset: '. print_r($field_group_fieldset, TRUE) .'</pre>');
  35. //table of fields
  36. $field_group = new stdClass();
  37. $field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  38. $field_group->api_version = 1;
  39. $field_group->identifier = 'group_summary_table|TripalEntity|'.$bundle_name.'|default';
  40. $field_group->group_name = 'group_summary_table';
  41. $field_group->entity_type = 'TripalEntity';
  42. $field_group->bundle = $bundle_name;
  43. $field_group->mode = 'default';
  44. $field_group->parent_name = 'group_summary';
  45. $field_group->data = array(
  46. 'label' => 'Summary Table',
  47. 'weight' => '30',
  48. 'children' => $fields,
  49. 'format_type' => 'table',
  50. 'format_settings' => array(
  51. 'label' => 'Summary Table',
  52. 'instance_settings' => array(
  53. 'label_visibility' => '1',
  54. 'desc' => '',
  55. 'first_column' => '',
  56. 'second_column' => '',
  57. 'empty_label_behavior' => '1',
  58. 'table_row_striping' => 0,
  59. 'always_show_field_label' => 0,
  60. 'classes' => 'group-summary-table field-group-table',
  61. ),
  62. ),
  63. );
  64. drupal_write_record('field_group', $field_group);
  65. }
  66. /**
  67. * Implements hook_field_group_info().
  68. */
  69. function tripal_ds_prop_field_group_info($bundle_name, $fields){
  70. //fieldset field to nest the table within
  71. $field_group_fieldset = new stdClass();
  72. $field_group_fieldset->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  73. $field_group_fieldset->api_version = 1;
  74. $field_group_fieldset->identifier = 'group_prop|TripalEntity|'.$bundle_name.'|default';
  75. $field_group_fieldset->group_name = 'group_prop';
  76. $field_group_fieldset->entity_type = 'TripalEntity';
  77. $field_group_fieldset->bundle = $bundle_name;
  78. $field_group_fieldset->mode = 'default';
  79. $field_group_fieldset->parent_name = '';
  80. $field_group_fieldset->data = array(
  81. 'label' => 'Prop',
  82. 'weight' => '3',
  83. 'children' => array(
  84. 0 => 'group_prop_table',
  85. ),
  86. 'format_type' => 'fieldset',
  87. 'format_settings' => array(
  88. 'label' => 'Prop',
  89. 'instance_settings' => array(
  90. 'id' => '',
  91. 'classes' => 'group-prop field-group-fieldset',
  92. 'description' => '',
  93. ),
  94. 'formatter' => 'collapsible',
  95. ),
  96. );
  97. drupal_write_record('field_group', $field_group_fieldset);
  98. //table of fields
  99. $field_group = new stdClass();
  100. $field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  101. $field_group->api_version = 1;
  102. $field_group->identifier = 'group_prop_table|TripalEntity|'.$bundle_name.'|default';
  103. $field_group->group_name = 'group_prop_table';
  104. $field_group->entity_type = 'TripalEntity';
  105. $field_group->bundle = $bundle_name;
  106. $field_group->mode = 'default';
  107. $field_group->parent_name = 'group_prop';
  108. $field_group->data = array(
  109. 'label' => 'Prop Table',
  110. 'weight' => '30',
  111. 'children' => $fields,
  112. 'format_type' => 'table',
  113. 'format_settings' => array(
  114. 'label' => 'Prop Table',
  115. 'instance_settings' => array(
  116. 'label_visibility' => '1',
  117. 'desc' => '',
  118. 'first_column' => '',
  119. 'second_column' => '',
  120. 'empty_label_behavior' => '1',
  121. 'table_row_striping' => 0,
  122. 'always_show_field_label' => 0,
  123. 'classes' => 'group-prop-table field-group-table',
  124. ),
  125. ),
  126. );
  127. drupal_write_record('field_group', $field_group);
  128. }
  129. /**
  130. * Implements hook_field_group_info().
  131. */
  132. function tripal_ds_data_sequence_field_group_info($bundle_name, $fields){
  133. //fieldset field to nest the table within
  134. $field_group_fieldset = new stdClass();
  135. $field_group_fieldset->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  136. $field_group_fieldset->api_version = 1;
  137. $field_group_fieldset->identifier = 'group_sequence|TripalEntity|'.$bundle_name.'|default';
  138. $field_group_fieldset->group_name = 'group_sequence';
  139. $field_group_fieldset->entity_type = 'TripalEntity';
  140. $field_group_fieldset->bundle = $bundle_name;
  141. $field_group_fieldset->mode = 'default';
  142. $field_group_fieldset->parent_name = '';
  143. $field_group_fieldset->data = array(
  144. 'label' => 'Data Sequences',
  145. 'weight' => '2',
  146. 'children' => array(
  147. 0 => 'group_sequence_table',
  148. ),
  149. 'format_type' => 'fieldset',
  150. 'format_settings' => array(
  151. 'label' => 'Data Sequences',
  152. 'instance_settings' => array(
  153. 'id' => '',
  154. 'classes' => 'group-sequence field-group-fieldset',
  155. 'description' => '',
  156. ),
  157. 'formatter' => 'collapsible',
  158. ),
  159. );
  160. drupal_write_record('field_group', $field_group_fieldset);
  161. //table of fields
  162. $field_group = new stdClass();
  163. $field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  164. $field_group->api_version = 1;
  165. $field_group->identifier = 'group_sequence_table|TripalEntity|'.$bundle_name.'|default';
  166. $field_group->group_name = 'group_sequence_table';
  167. $field_group->entity_type = 'TripalEntity';
  168. $field_group->bundle = $bundle_name;
  169. $field_group->mode = 'default';
  170. $field_group->parent_name = 'group_sequence';
  171. $field_group->data = array(
  172. 'label' => 'Data Sequences Table',
  173. 'weight' => '30',
  174. 'children' => $fields,
  175. 'format_type' => 'table',
  176. 'format_settings' => array(
  177. 'label' => 'Data Sequences Table',
  178. 'instance_settings' => array(
  179. 'label_visibility' => '1',
  180. 'desc' => '',
  181. 'first_column' => '',
  182. 'second_column' => '',
  183. 'empty_label_behavior' => '1',
  184. 'table_row_striping' => 0,
  185. 'always_show_field_label' => 0,
  186. 'classes' => 'group-sequence-table field-group-table',
  187. ),
  188. ),
  189. );
  190. drupal_write_record('field_group', $field_group);
  191. }
  192. /**
  193. * Implements hook_field_group_info().
  194. * Processes all additional fields into Tripal Panes
  195. */
  196. function tripal_ds_additional_fields_field_group_info($bundle_name, $field_label, $group_field_name, $fieldset_field_name, $field_name){
  197. //fieldset field to nest the table within
  198. $field_group_fieldset = new stdClass();
  199. $field_group_fieldset->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  200. $field_group_fieldset->api_version = 1;
  201. $field_group_fieldset->identifier = $group_field_name.'|TripalEntity|'.$bundle_name.'|default';
  202. $field_group_fieldset->group_name = $group_field_name;
  203. $field_group_fieldset->entity_type = 'TripalEntity';
  204. $field_group_fieldset->bundle = $bundle_name;
  205. $field_group_fieldset->mode = 'default';
  206. $field_group_fieldset->parent_name = '';
  207. $field_group_fieldset->data = array(
  208. 'label' => $field_label.' Fieldgroup',
  209. 'weight' => '5',
  210. 'children' => array(
  211. 0 => $fieldset_field_name,
  212. ),
  213. 'format_type' => 'fieldset',
  214. 'format_settings' => array(
  215. 'label' => $field_label.' Fieldgroup',
  216. 'instance_settings' => array(
  217. 'id' => '',
  218. 'classes' => $group_field_name.' field-group-fieldset',
  219. 'description' => '',
  220. ),
  221. 'formatter' => 'collapsible',
  222. ),
  223. );
  224. drupal_write_record('field_group', $field_group_fieldset);
  225. //table of fields
  226. $field_group = new stdClass();
  227. $field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  228. $field_group->api_version = 1;
  229. $field_group->identifier = $fieldset_field_name.'|TripalEntity|'.$bundle_name.'|default';
  230. $field_group->group_name = $fieldset_field_name;
  231. $field_group->entity_type = 'TripalEntity';
  232. $field_group->bundle = $bundle_name;
  233. $field_group->mode = 'default';
  234. $field_group->parent_name = $group_field_name;
  235. $field_group->data = array(
  236. 'label' => $field_label.' Fieldset',
  237. 'weight' => '30',
  238. 'children' => array(
  239. 0 =>$field_name,
  240. ),
  241. 'format_type' => 'table',
  242. 'format_type' => 'fieldset',
  243. 'format_settings' => array(
  244. 'label' => $field_label.' Fieldset',
  245. 'instance_settings' => array(
  246. 'id' => '',
  247. 'classes' => $fieldset_field_name.' field-group-fieldset',
  248. 'description' => '',
  249. ),
  250. 'formatter' => 'collapsible',
  251. ),
  252. );
  253. drupal_write_record('field_group', $field_group);
  254. }