tripal_ds.field_group.inc 18 KB

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