tripal_ds.field_group.inc 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. <?php
  2. /**
  3. * Implements hook_field_group_info().
  4. */
  5. function _summary_field_group_info($bundle_name, $fields){
  6. //Tripal pane to nest the summary fieldset within.
  7. $field_group_tripalpane = new stdClass();
  8. $field_group_tripalpane->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  9. $field_group_tripalpane->api_version = 1;
  10. $field_group_tripalpane->identifier = 'group_summary_tripalpane|TripalEntity|'.$bundle_name.'|default';
  11. $field_group_tripalpane->group_name = 'group_summary_tripalpane';
  12. $field_group_tripalpane->entity_type = 'TripalEntity';
  13. $field_group_tripalpane->bundle = $bundle_name;
  14. $field_group_tripalpane->mode = 'default';
  15. $field_group_tripalpane->parent_name = '';
  16. $field_group_tripalpane->data = array(
  17. 'label' => 'Tripal Pane Summary',
  18. 'weight' => '1',
  19. 'children' => array(
  20. 0 => 'group_summary',
  21. ),
  22. 'format_type' => 'tripalpane',
  23. 'format_settings' => array(
  24. 'label' => 'Tripal Pane Summary',
  25. 'instance_settings' => array(
  26. 'id' => 'tripal_ds-fieldset-group_summary_tripalpane',
  27. 'classes' => 'group-summary-tripalpane field-group-tripalpane',
  28. 'description' => '',
  29. ),
  30. ),
  31. );
  32. drupal_write_record('field_group', $field_group_tripalpane);
  33. //Write to the tripal_ds table to record the new tripal pane.
  34. tripal_ds_bundle_menu_item($bundle_name, 'Summary', 'group_summary_tripalpane', 'TripalEntity');
  35. //Fieldset field to nest the table within.
  36. $field_group_fieldset = new stdClass();
  37. $field_group_fieldset->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  38. $field_group_fieldset->api_version = 1;
  39. $field_group_fieldset->identifier = 'group_summary|TripalEntity|'.$bundle_name.'|default';
  40. $field_group_fieldset->group_name = 'group_summary';
  41. $field_group_fieldset->entity_type = 'TripalEntity';
  42. $field_group_fieldset->bundle = $bundle_name;
  43. $field_group_fieldset->mode = 'default';
  44. $field_group_fieldset->parent_name = 'group_summary_tripalpane';
  45. $field_group_fieldset->data = array(
  46. 'label' => 'Summary',
  47. 'weight' => '5',
  48. 'children' => array(
  49. 0 => 'group_summary_table',
  50. ),
  51. 'format_type' => 'fieldset',
  52. 'format_settings' => array(
  53. 'label' => 'Summary',
  54. 'instance_settings' => array(
  55. 'id' => '',
  56. 'classes' => 'group-summary field-group-fieldset',
  57. 'description' => '',
  58. ),
  59. 'formatter' => 'collapsible',
  60. ),
  61. );
  62. drupal_write_record('field_group', $field_group_fieldset);
  63. //Table of fields.
  64. $field_group = new stdClass();
  65. $field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  66. $field_group->api_version = 1;
  67. $field_group->identifier = 'group_summary_table|TripalEntity|'.$bundle_name.'|default';
  68. $field_group->group_name = 'group_summary_table';
  69. $field_group->entity_type = 'TripalEntity';
  70. $field_group->bundle = $bundle_name;
  71. $field_group->mode = 'default';
  72. $field_group->parent_name = 'group_summary';
  73. $field_group->data = array(
  74. 'label' => 'Summary Table',
  75. 'weight' => '30',
  76. 'children' => $fields,
  77. 'format_type' => 'table',
  78. 'format_settings' => array(
  79. 'label' => 'Summary Table',
  80. 'instance_settings' => array(
  81. 'label_visibility' => '1',
  82. 'desc' => '',
  83. 'first_column' => '',
  84. 'second_column' => '',
  85. 'empty_label_behavior' => '1',
  86. 'table_row_striping' => 0,
  87. 'always_show_field_label' => 0,
  88. 'classes' => 'group-summary-table field-group-table',
  89. ),
  90. ),
  91. );
  92. drupal_write_record('field_group', $field_group);
  93. }
  94. /**
  95. * Implements hook_field_group_info().
  96. */
  97. function _prop_field_group_info($bundle_name, $fields){
  98. //Tripal pane to nest the fieldset within.
  99. $field_group_tripalpane = new stdClass();
  100. $field_group_tripalpane->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  101. $field_group_tripalpane->api_version = 1;
  102. $field_group_tripalpane->identifier = 'group_prop_tripalpane|TripalEntity|'.$bundle_name.'|default';
  103. $field_group_tripalpane->group_name = 'group_prop_tripalpane';
  104. $field_group_tripalpane->entity_type = 'TripalEntity';
  105. $field_group_tripalpane->bundle = $bundle_name;
  106. $field_group_tripalpane->mode = 'default';
  107. $field_group_tripalpane->parent_name = '';
  108. $field_group_tripalpane->data = array(
  109. 'label' => 'Properties Tripal Pane',
  110. 'weight' => '2',
  111. 'children' => array(
  112. 0 => 'group_prop',
  113. ),
  114. 'format_type' => 'tripalpane',
  115. 'format_settings' => array(
  116. 'label' => 'Tripal Pane Properties',
  117. 'instance_settings' => array(
  118. 'id' => 'tripal_ds-fieldset-group_prop_tripalpane',
  119. 'classes' => 'group-prop-tripalpane field-group-tripalpane',
  120. 'description' => '',
  121. ),
  122. ),
  123. );
  124. drupal_write_record('field_group', $field_group_tripalpane);
  125. //write to the tripal_ds table to record the new tripal pane.
  126. tripal_ds_bundle_menu_item($bundle_name, 'Properties', 'group_prop_tripalpane', 'TripalEntity');
  127. //Fieldset field to nest the table within.
  128. $field_group_fieldset = new stdClass();
  129. $field_group_fieldset->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  130. $field_group_fieldset->api_version = 1;
  131. $field_group_fieldset->identifier = 'group_prop|TripalEntity|'.$bundle_name.'|default';
  132. $field_group_fieldset->group_name = 'group_prop';
  133. $field_group_fieldset->entity_type = 'TripalEntity';
  134. $field_group_fieldset->bundle = $bundle_name;
  135. $field_group_fieldset->mode = 'default';
  136. $field_group_fieldset->parent_name = 'group_prop_tripalpane';
  137. $field_group_fieldset->data = array(
  138. 'label' => 'Properties',
  139. 'weight' => '3',
  140. 'children' => array(
  141. 0 => 'group_prop_table',
  142. ),
  143. 'format_type' => 'fieldset',
  144. 'format_settings' => array(
  145. 'label' => 'Properties',
  146. 'instance_settings' => array(
  147. 'id' => '',
  148. 'classes' => 'group-prop field-group-fieldset',
  149. 'description' => '',
  150. ),
  151. 'formatter' => 'collapsible',
  152. ),
  153. );
  154. drupal_write_record('field_group', $field_group_fieldset);
  155. //Table of fields.
  156. $field_group = new stdClass();
  157. $field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  158. $field_group->api_version = 1;
  159. $field_group->identifier = 'group_prop_table|TripalEntity|'.$bundle_name.'|default';
  160. $field_group->group_name = 'group_prop_table';
  161. $field_group->entity_type = 'TripalEntity';
  162. $field_group->bundle = $bundle_name;
  163. $field_group->mode = 'default';
  164. $field_group->parent_name = 'group_prop';
  165. $field_group->data = array(
  166. 'label' => 'Properties Table',
  167. 'weight' => '30',
  168. 'children' => $fields,
  169. 'format_type' => 'table',
  170. 'format_settings' => array(
  171. 'label' => 'Properties Table',
  172. 'instance_settings' => array(
  173. 'label_visibility' => '1',
  174. 'desc' => '',
  175. 'first_column' => '',
  176. 'second_column' => '',
  177. 'empty_label_behavior' => '1',
  178. 'table_row_striping' => 0,
  179. 'always_show_field_label' => 0,
  180. 'classes' => 'group-prop-table field-group-table',
  181. ),
  182. ),
  183. );
  184. drupal_write_record('field_group', $field_group);
  185. }
  186. /**
  187. * Implements hook_field_group_info().
  188. */
  189. function _data_sequence_field_group_info($bundle_name, $fields){
  190. //Tripal pane to nest the fieldset within.
  191. $field_group_tripalpane = new stdClass();
  192. $field_group_tripalpane->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  193. $field_group_tripalpane->api_version = 1;
  194. $field_group_tripalpane->identifier = 'group_sequence_tripalpane|TripalEntity|'.$bundle_name.'|default';
  195. $field_group_tripalpane->group_name = 'group_sequence_tripalpane';
  196. $field_group_tripalpane->entity_type = 'TripalEntity';
  197. $field_group_tripalpane->bundle = $bundle_name;
  198. $field_group_tripalpane->mode = 'default';
  199. $field_group_tripalpane->parent_name = '';
  200. $field_group_tripalpane->data = array(
  201. 'label' => 'Tripal Pane Data Sequences',
  202. 'weight' => '2',
  203. 'children' => array(
  204. 0 => 'group_sequence',
  205. ),
  206. 'format_type' => 'tripalpane',
  207. 'format_settings' => array(
  208. 'label' => 'Tripal Pane Data Sequences',
  209. 'instance_settings' => array(
  210. 'id' => 'tripal_ds-fieldset-group_sequence_tripalpane',
  211. 'classes' => 'group-sequence-tripalpane field-group-tripalpane',
  212. 'description' => '',
  213. ),
  214. ),
  215. );
  216. drupal_write_record('field_group', $field_group_tripalpane);
  217. //Write to the tripal_ds table to record the new tripal pane.
  218. tripal_ds_bundle_menu_item($bundle_name, 'Sequence', 'group_sequence_tripalpane', 'TripalEntity');
  219. //Fieldset field to nest the table within.
  220. $field_group_fieldset = new stdClass();
  221. $field_group_fieldset->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  222. $field_group_fieldset->api_version = 1;
  223. $field_group_fieldset->identifier = 'group_sequence|TripalEntity|'.$bundle_name.'|default';
  224. $field_group_fieldset->group_name = 'group_sequence';
  225. $field_group_fieldset->entity_type = 'TripalEntity';
  226. $field_group_fieldset->bundle = $bundle_name;
  227. $field_group_fieldset->mode = 'default';
  228. $field_group_fieldset->parent_name = 'group_sequence_tripalpane';
  229. $field_group_fieldset->data = array(
  230. 'label' => 'Sequence',
  231. 'weight' => '3',
  232. 'children' => array(
  233. 0 => 'group_sequence_table',
  234. ),
  235. 'format_type' => 'fieldset',
  236. 'format_settings' => array(
  237. 'label' => 'Data Sequences',
  238. 'instance_settings' => array(
  239. 'id' => '',
  240. 'classes' => 'group-sequence field-group-fieldset',
  241. 'description' => '',
  242. ),
  243. 'formatter' => 'collapsible',
  244. ),
  245. );
  246. drupal_write_record('field_group', $field_group_fieldset);
  247. //Table of fields.
  248. $field_group = new stdClass();
  249. $field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  250. $field_group->api_version = 1;
  251. $field_group->identifier = 'group_sequence_table|TripalEntity|'.$bundle_name.'|default';
  252. $field_group->group_name = 'group_sequence_table';
  253. $field_group->entity_type = 'TripalEntity';
  254. $field_group->bundle = $bundle_name;
  255. $field_group->mode = 'default';
  256. $field_group->parent_name = 'group_sequence';
  257. $field_group->data = array(
  258. 'label' => 'Data Sequences Table',
  259. 'weight' => '30',
  260. 'children' => $fields,
  261. 'format_type' => 'table',
  262. 'format_settings' => array(
  263. 'label' => 'Data Sequences Table',
  264. 'instance_settings' => array(
  265. 'label_visibility' => '1',
  266. 'desc' => '',
  267. 'first_column' => '',
  268. 'second_column' => '',
  269. 'empty_label_behavior' => '1',
  270. 'table_row_striping' => 0,
  271. 'always_show_field_label' => 0,
  272. 'classes' => 'group-sequence-table field-group-table',
  273. ),
  274. ),
  275. );
  276. drupal_write_record('field_group', $field_group);
  277. }
  278. /**
  279. * Implements hook_field_group_info().
  280. * Processes all additional fields into Tripal Panes
  281. */
  282. function _additional_fields_field_group_info($bundle_name, $field_label, $group_field_name, $fieldset_field_name, $field_name){
  283. //Write to the tripal_ds table to record the new tripal pane.
  284. tripal_ds_bundle_menu_item($bundle_name, $field_label, $group_field_name, 'TripalEntity');
  285. //Tripal pane to nest the fieldset within.
  286. $field_group_fieldset = new stdClass();
  287. $field_group_fieldset->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  288. $field_group_fieldset->api_version = 1;
  289. $field_group_fieldset->identifier = $group_field_name.'|TripalEntity|'.$bundle_name.'|default';
  290. $field_group_fieldset->group_name = $group_field_name;
  291. $field_group_fieldset->entity_type = 'TripalEntity';
  292. $field_group_fieldset->bundle = $bundle_name;
  293. $field_group_fieldset->mode = 'default';
  294. $field_group_fieldset->parent_name = '';
  295. $field_group_fieldset->data = array(
  296. 'label' => $field_label.' TripalPane',
  297. 'weight' => '5',
  298. 'children' => array(
  299. 0 => $fieldset_field_name,
  300. ),
  301. 'format_type' => 'tripalpane',
  302. 'format_settings' => array(
  303. 'label' => $field_label.' TripalPane',
  304. 'instance_settings' => array(
  305. 'id' => 'tripal_ds-fieldset-'.$group_field_name,
  306. 'classes' => $group_field_name.' field-group-tripalpane',
  307. 'description' => '',
  308. ),
  309. 'formatter' => 'collapsible',
  310. ),
  311. );
  312. drupal_write_record('field_group', $field_group_fieldset);
  313. //Fieldset to nest the field within the tripal pane.
  314. $field_group = new stdClass();
  315. $field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  316. $field_group->api_version = 1;
  317. $field_group->identifier = $fieldset_field_name.'|TripalEntity|'.$bundle_name.'|default';
  318. $field_group->group_name = $fieldset_field_name;
  319. $field_group->entity_type = 'TripalEntity';
  320. $field_group->bundle = $bundle_name;
  321. $field_group->mode = 'default';
  322. $field_group->parent_name = $group_field_name;
  323. $field_group->data = array(
  324. 'label' => $field_label,
  325. 'weight' => '30',
  326. 'children' => array(
  327. 0 =>$field_name,
  328. ),
  329. 'format_type' => 'fieldset',
  330. 'format_settings' => array(
  331. 'label' => $field_label,
  332. 'instance_settings' => array(
  333. 'label_visibility' => '1',
  334. 'id' => '',
  335. 'classes' => $fieldset_field_name.' field-group-fieldset',
  336. 'description' => '',
  337. ),
  338. 'formatter' => 'collapsible',
  339. ),
  340. );
  341. drupal_write_record('field_group', $field_group);
  342. }
  343. /**
  344. * Implements hook_field_group_info().
  345. */
  346. function _publication_prop_field_group_info($bundle_name, $fields){
  347. //Tripal pane to nest the fieldset within.
  348. $field_group_tripalpane = new stdClass();
  349. $field_group_tripalpane->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  350. $field_group_tripalpane->api_version = 1;
  351. $field_group_tripalpane->identifier = 'group_prop_tripalpane|TripalEntity|'.$bundle_name.'|default';
  352. $field_group_tripalpane->group_name = 'group_prop_tripalpane';
  353. $field_group_tripalpane->entity_type = 'TripalEntity';
  354. $field_group_tripalpane->bundle = $bundle_name;
  355. $field_group_tripalpane->mode = 'default';
  356. $field_group_tripalpane->parent_name = '';
  357. $field_group_tripalpane->data = array(
  358. 'label' => 'Properties Tripal Pane',
  359. 'weight' => '2',
  360. 'children' => array(
  361. 0 => 'group_prop',
  362. ),
  363. 'format_type' => 'tripalpane',
  364. 'format_settings' => array(
  365. 'label' => 'Tripal Pane Properties',
  366. 'instance_settings' => array(
  367. 'id' => 'tripal_ds-fieldset-group_prop_tripalpane',
  368. 'classes' => 'group-prop-tripalpane field-group-tripalpane',
  369. 'description' => '',
  370. ),
  371. ),
  372. );
  373. drupal_write_record('field_group', $field_group_tripalpane);
  374. //write to the tripal_ds table to record the new tripal pane.
  375. tripal_ds_bundle_menu_item($bundle_name, 'Properties', 'group_prop_tripalpane', 'TripalEntity');
  376. //Fieldset field to nest the table within.
  377. $field_group_fieldset = new stdClass();
  378. $field_group_fieldset->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  379. $field_group_fieldset->api_version = 1;
  380. $field_group_fieldset->identifier = 'group_prop|TripalEntity|'.$bundle_name.'|default';
  381. $field_group_fieldset->group_name = 'group_prop';
  382. $field_group_fieldset->entity_type = 'TripalEntity';
  383. $field_group_fieldset->bundle = $bundle_name;
  384. $field_group_fieldset->mode = 'default';
  385. $field_group_fieldset->parent_name = 'group_prop_tripalpane';
  386. $field_group_fieldset->data = array(
  387. 'label' => 'Properties',
  388. 'weight' => '3',
  389. 'children' => array(
  390. 0 => 'group_prop_table',
  391. ),
  392. 'format_type' => 'fieldset',
  393. 'format_settings' => array(
  394. 'label' => 'Properties',
  395. 'instance_settings' => array(
  396. 'id' => '',
  397. 'classes' => 'group-prop field-group-fieldset',
  398. 'description' => '',
  399. ),
  400. 'formatter' => 'collapsible',
  401. ),
  402. );
  403. drupal_write_record('field_group', $field_group_fieldset);
  404. //Table of fields.
  405. $field_group = new stdClass();
  406. $field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
  407. $field_group->api_version = 1;
  408. $field_group->identifier = 'group_prop_table|TripalEntity|'.$bundle_name.'|default';
  409. $field_group->group_name = 'group_prop_table';
  410. $field_group->entity_type = 'TripalEntity';
  411. $field_group->bundle = $bundle_name;
  412. $field_group->mode = 'default';
  413. $field_group->parent_name = 'group_prop';
  414. $field_group->data = array(
  415. 'label' => 'Properties Table',
  416. 'weight' => '30',
  417. 'children' => array(
  418. 0 => 'tpub__doi',
  419. 1 => 'tpub__publication_date',
  420. 2 => 'tpub__publication_type',
  421. ),
  422. 'format_type' => 'table',
  423. 'format_settings' => array(
  424. 'label' => 'Properties Table',
  425. 'instance_settings' => array(
  426. 'label_visibility' => '1',
  427. 'desc' => '',
  428. 'first_column' => '',
  429. 'second_column' => '',
  430. 'empty_label_behavior' => '1',
  431. 'table_row_striping' => 0,
  432. 'always_show_field_label' => 0,
  433. 'classes' => 'group-prop-table field-group-table',
  434. ),
  435. ),
  436. );
  437. drupal_write_record('field_group', $field_group);
  438. }