tripal_core.module 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. <?php
  2. /**
  3. * @file
  4. * The Tripal Core module
  5. */
  6. /**
  7. * @defgroup tripal_modules Tripal Modules
  8. * @{
  9. * All documented functions for the various Tripal Modules excluding API functions and Views Integration functions.
  10. * @}
  11. */
  12. /**
  13. * @defgroup tripal_api Tripal API
  14. * @{
  15. * Provides an application programming interface (API) for Tripal
  16. *
  17. * The Tripal API currently provides generic insert/update/select functions for all chado content as
  18. * well as some module specific functions that insert/update/delete/select specific chado content.
  19. *
  20. * This API is currently in its infancy and some necessary functions might be missing. If you find
  21. * a missing function that you think should be included go to the sourceforge feature request
  22. * page and request it's inclusion in the API. Such feature requests with a working function
  23. * definition will be given priority.
  24. * @}
  25. */
  26. /**
  27. * @defgroup tripal_core_api Core Module API
  28. * @ingroup tripal_api
  29. * @{
  30. * Functions providing support for all Tripal modules.
  31. * @}
  32. */
  33. /**
  34. * @defgroup tripal_core Tripal Core Module
  35. * @ingroup tripal_modules
  36. * @{
  37. * Functionality useful for all other Tripal modules including the Tripal jobs, files,
  38. * materialized views and custom table functions.
  39. * @}
  40. */
  41. // APPLICATION PROGRAMMER INTERFACE -------------
  42. // Chado API
  43. require_once "api/tripal_core.chado_general.api.inc";
  44. require_once 'api/tripal_core.chado_query.api.inc';
  45. require_once 'api/tripal_core.chado_variables.api.inc';
  46. require_once 'api/tripal_core.chado_schema.api.inc';
  47. require_once "api/tripal_core.chado_nodes.api.inc";
  48. require_once "api/tripal_core.chado_nodes.properties.api.inc";
  49. require_once "api/tripal_core.chado_nodes.dbxrefs.api.inc";
  50. require_once "api/tripal_core.chado_nodes.relationships.api.inc";
  51. // Table API
  52. require_once "api/tripal_core.custom_tables.api.inc";
  53. require_once "api/tripal_core.mviews.api.inc";
  54. // Miscellaneous API
  55. require_once "api/tripal_core.files.api.inc";
  56. require_once "api/tripal_core.jobs.api.inc";
  57. // INCLUDES -------------------------------------
  58. require_once "includes/jobs.inc";
  59. require_once "includes/mviews.inc";
  60. require_once "includes/custom_tables.inc";
  61. require_once "includes/chado_install.inc";
  62. require_once "includes/form_elements.inc";
  63. tripal_core_set_globals();
  64. /**
  65. * Implements hook_init().
  66. * Used to set the search_path, create default content and set default variables.
  67. *
  68. * @ingroup tripal_core
  69. */
  70. function tripal_core_init() {
  71. global $base_url;
  72. // add javascript files
  73. drupal_add_js(drupal_get_path('module', 'tripal_core') . '/theme/js/tripal.js');
  74. drupal_add_css(drupal_get_path('module', 'tripal_core') . '/theme/css/tripal.css');
  75. // create the 'tripal' controlled volcabulary in chado but only if it doesn't already exist, and
  76. // only if the chado database is present.
  77. if ($GLOBALS["chado_is_installed"]) {
  78. // if the Tripal cv is missing then add
  79. $results = chado_query("SELECT * FROM {cv} WHERE name = 'tripal'");
  80. $tripal_cv = $results->fetchObject();
  81. if (!$tripal_cv) {
  82. $results = chado_query(
  83. "INSERT INTO {cv} (name,definition) " .
  84. "VALUES ('tripal', 'Terms used by Tripal for modules to manage data such as that stored in property tables like featureprop, analysisprop, etc')"
  85. );
  86. }
  87. // if the Tripal db is missing then add it
  88. $results = chado_query("SELECT * FROM {db} WHERE name = 'tripal'");
  89. $tripal_db = $results->fetchObject();
  90. if (!$tripal_db) {
  91. $results = chado_query(
  92. "INSERT INTO {db} (name,description) " .
  93. "VALUES ('tripal', 'Used as a database placeholder for tripal defined objects such as tripal cvterms')"
  94. );
  95. }
  96. }
  97. // add some variables for all javasript to use for building URLs
  98. $theme_dir = drupal_get_path('theme', 'tripal');
  99. $clean_urls = variable_get('clean_url', 0);
  100. drupal_add_js(
  101. " var baseurl = '$base_url';
  102. var themedir = '$theme_dir';
  103. var isClean = $clean_urls;",
  104. 'inline', 'header');
  105. // make sure the date time settings are the way Tripal will insert them
  106. // otherwise PostgreSQL version that may have a different datestyle setting
  107. // will fail when inserting or updating a date column in a table.
  108. db_query("SET DATESTYLE TO :style", array(':style' => 'MDY'));
  109. // If we want AHAH elements on the node forms (e.g. chado_pub form) then we need to include
  110. // the node.pages file. Otherwise this error message is given:
  111. //
  112. // warning: call_user_func_array() expects parameter 1 to be a valid callback,
  113. // function 'node_form' not found or invalid function name
  114. // in /var/www/includes/form.inc on line 382.
  115. module_load_include('inc', 'node', 'node.pages');
  116. }
  117. /**
  118. * Implements hook_menu().
  119. * Defines all menu items needed by Tripal Core
  120. *
  121. * @ingroup tripal_core
  122. */
  123. function tripal_core_menu() {
  124. $items = array();
  125. // Triapl setting groups
  126. $items['admin/tripal'] = array(
  127. 'title' => 'Tripal',
  128. 'description' => "Manage the behavior or Tripal and its various modules.",
  129. 'weight' => -8,
  130. 'page callback' => 'system_admin_menu_block_page',
  131. 'access arguments' => array('administer tripal'),
  132. 'file' => 'system.admin.inc',
  133. 'file path' => drupal_get_path('module', 'system'),
  134. );
  135. $items['admin/tripal/schema'] = array(
  136. 'title' => 'Chado Schema',
  137. 'description' => "Tools to extend the chado schema through custom tables & materialized views.",
  138. 'weight' => -2,
  139. 'access arguments' => array('administer tripal'),
  140. );
  141. $items['admin/tripal/chado'] = array(
  142. 'title' => 'Chado Modules',
  143. 'description' => 'Configuration for specific chado data types such as Vocabularies, Features, etc.',
  144. 'access arguments' => array('administer tripal'),
  145. 'type' => MENU_NORMAL_ITEM,
  146. 'weight' => -6
  147. );
  148. $items['admin/tripal/loaders'] = array(
  149. 'title' => 'Chado Data Loaders',
  150. 'description' => 'Tools facilitating loading data into the chado database. Includes a generic tab-delimited loader (Bulk Loader).',
  151. 'access arguments' => array('administer tripal'),
  152. 'type' => MENU_NORMAL_ITEM,
  153. 'weight' => -4
  154. );
  155. $items['admin/tripal/extension'] = array(
  156. 'title' => 'Extension Modules',
  157. 'description' => 'Configuration for Tripal extension modules.',
  158. 'access arguments' => array('administer tripal'),
  159. 'type' => MENU_NORMAL_ITEM,
  160. 'weight' => 0
  161. );
  162. // Tripal Setup
  163. $items['admin/tripal/setup'] = array(
  164. 'title' => 'Setup Tripal',
  165. 'description' => 'Tools for initial setup of Tripal',
  166. 'access arguments' => array('administer tripal'),
  167. 'weight' => -8
  168. );
  169. $items['admin/tripal/setup/customize'] = array(
  170. 'title' => 'Customize Tripal',
  171. 'description' => 'Information on how to customize tripal',
  172. 'page callback' => 'theme',
  173. 'page arguments' => array('tripal_core_customize'),
  174. 'access arguments' => array('administer tripal'),
  175. 'weight' => 10
  176. );
  177. $items['admin/tripal/setup/chado_install'] = array(
  178. 'title' => 'Install Chado Schema',
  179. 'description' => 'Installs the Chado database tables, views, etc., inside the current Drupal database',
  180. 'page callback' => 'drupal_get_form',
  181. 'page arguments' => array('tripal_core_chado_load_form'),
  182. 'access arguments' => array('install chado'),
  183. 'type' => MENU_NORMAL_ITEM,
  184. 'weight' => -10
  185. );
  186. // Jobs Management
  187. $items['admin/tripal/tripal_jobs'] = array(
  188. 'title' => 'Jobs',
  189. 'description' => 'Jobs managed by Tripal',
  190. 'page callback' => 'tripal_jobs_admin_view',
  191. 'access arguments' => array('administer tripal'),
  192. 'type' => MENU_NORMAL_ITEM,
  193. 'weight' => -10
  194. );
  195. $items['admin/tripal/tripal_jobs/help'] = array(
  196. 'title' => 'Help',
  197. 'description' => 'Help for the tripal job management system',
  198. 'page callback' => 'theme',
  199. 'page arguments' => array('tripal_core_job_help'),
  200. 'access arguments' => array('administer tripal'),
  201. 'type' => MENU_LOCAL_TASK,
  202. 'weight' => 10
  203. );
  204. $items['admin/tripal/tripal_jobs/cancel/%'] = array(
  205. 'title' => 'Jobs',
  206. 'description' => 'Cancel a pending job',
  207. 'page callback' => 'tripal_jobs_cancel',
  208. 'page arguments' => array(4),
  209. 'access arguments' => array('administer tripal'),
  210. 'type' => MENU_CALLBACK,
  211. );
  212. $items['admin/tripal/tripal_jobs/rerun/%'] = array(
  213. 'title' => 'Jobs',
  214. 'description' => 'Re-run an existing job.',
  215. 'page callback' => 'tripal_jobs_rerun',
  216. 'page arguments' => array(4),
  217. 'access arguments' => array('administer tripal'),
  218. 'type' => MENU_CALLBACK,
  219. );
  220. $items['admin/tripal/tripal_jobs/view/%'] = array(
  221. 'title' => 'Jobs Details',
  222. 'description' => 'View job details.',
  223. 'page callback' => 'tripal_jobs_view',
  224. 'page arguments' => array(4),
  225. 'access arguments' => array('administer tripal'),
  226. 'type' => MENU_CALLBACK,
  227. );
  228. $items['admin/tripal/tripal_jobs/views/jobs/enable'] = array(
  229. 'title' => 'Enable Jobs Administrative View',
  230. 'page callback' => 'tripal_views_admin_enable_view',
  231. 'page arguments' => array('tripal_core_admin_jobs', 'admin/tripal/tripal_jobs'),
  232. 'access arguments' => array('administer tripal'),
  233. 'type' => MENU_CALLBACK,
  234. );
  235. // Materialized Views
  236. $items['admin/tripal/schema/mviews'] = array(
  237. 'title' => 'Materialized Views',
  238. 'description' => 'Materialized views are used to improve speed of large or complex queries.',
  239. 'page callback' => 'tripal_mview_admin_view',
  240. 'access arguments' => array('administer tripal'),
  241. 'type' => MENU_NORMAL_ITEM,
  242. 'weight' => -10
  243. );
  244. $items['admin/tripal/schema/mviews/help'] = array(
  245. 'title' => 'Help',
  246. 'description' => 'Help for the materialized views management system',
  247. 'page callback' => 'theme',
  248. 'page arguments' => array('tripal_core_mviews_help'),
  249. 'access arguments' => array('administer tripal'),
  250. 'type' => MENU_LOCAL_TASK,
  251. 'weight' => 10
  252. );
  253. /**
  254. $items['admin/tripal/schema/mviews/list'] = array(
  255. 'title' => 'List Materialized Views',
  256. 'description' => 'A list of existing materialized views with the ability to edit & delete existing materialized views.',
  257. 'page callback' => 'tripal_mviews_report',
  258. 'access arguments' => array('administer tripal'),
  259. 'type' => MENU_NORMAL_ITEM,
  260. 'weight' => -10
  261. );
  262. */
  263. $items['admin/tripal/schema/mviews/report/%'] = array(
  264. 'title' => 'Materialized View',
  265. 'description' => 'Materialized views are used to improve speed of large or complex queries. These are database views as compared to Drupal views.',
  266. 'page callback' => 'tripal_mview_report',
  267. 'page arguments' => array(5),
  268. 'access arguments' => array('administer tripal'),
  269. 'type' => MENU_CALLBACK,
  270. );
  271. $items['admin/tripal/schema/mviews/new'] = array(
  272. 'title' => 'Create Materialized View',
  273. 'description' => 'Create a new materialized view.',
  274. 'page callback' => 'drupal_get_form',
  275. 'page arguments' => array('tripal_mviews_form'),
  276. 'access arguments' => array('administer tripal'),
  277. 'type' => MENU_CALLBACK,
  278. );
  279. $items['admin/tripal/schema/mviews/edit/%'] = array(
  280. 'title' => 'Edit Materialized View',
  281. 'page callback' => 'drupal_get_form',
  282. 'page arguments' => array('tripal_mviews_form', 5),
  283. 'access arguments' => array('administer tripal'),
  284. 'type' => MENU_CALLBACK,
  285. );
  286. $items['admin/tripal/schema/mviews/action/%/%'] = array(
  287. 'title' => 'Create Materialized View',
  288. 'description' => 'Materialized views are used to improve speed of large or complex queries.',
  289. 'page callback' => 'tripal_mviews_action',
  290. 'page arguments' => array(5, 6, "1"),
  291. 'access arguments' => array('administer tripal'),
  292. 'type' => MENU_CALLBACK,
  293. );
  294. // Custom Tables
  295. $items['admin/tripal/schema/custom_tables'] = array(
  296. 'title' => 'Custom Tables',
  297. 'description' => 'Creation of custom tables that are added to Chado database.',
  298. 'page callback' => 'tripal_custom_table_admin_view',
  299. 'access arguments' => array('administer tripal'),
  300. 'type' => MENU_NORMAL_ITEM,
  301. 'weight' => -10
  302. );
  303. $items['admin/tripal/schema/custom_tables/help'] = array(
  304. 'title' => 'Help',
  305. 'description' => 'Help for the tripal job management system',
  306. 'page callback' => 'theme',
  307. 'page arguments' => array('tripal_core_job_help'),
  308. 'access arguments' => array('administer tripal'),
  309. 'type' => MENU_LOCAL_TASK,
  310. 'weight' => 10
  311. );
  312. /**
  313. $items['admin/tripal/schema/custom_tables/list'] = array(
  314. 'title' => 'List of Custom Tables',
  315. 'description' => 'Provides a list of all custom tables created by Tripal and allows for editing or removing existing custom tables.',
  316. 'page callback' => 'tripal_custom_tables_list',
  317. 'access arguments' => array('administer tripal'),
  318. 'type' => MENU_NORMAL_ITEM,
  319. 'weight' => -10
  320. );
  321. */
  322. $items['admin/tripal/schema/custom_tables/view/%'] = array(
  323. 'title' => 'Custom Tables',
  324. 'description' => 'Custom tables are added to Chado.',
  325. 'page callback' => 'tripal_custom_table_view',
  326. 'page arguments' => array(4),
  327. 'access arguments' => array('administer tripal'),
  328. 'type' => MENU_CALLBACK,
  329. );
  330. $items['admin/tripal/schema/custom_tables/new'] = array(
  331. 'title' => 'Create Custom Table',
  332. 'description' => 'An interface for creating your own custom tables.',
  333. 'page callback' => 'tripal_custom_table_new_page',
  334. 'access arguments' => array('administer tripal'),
  335. 'type' => MENU_CALLBACK,
  336. );
  337. $items['admin/tripal/schema/custom_tables/edit/%'] = array(
  338. 'title' => 'Edit Custom Table',
  339. 'page callback' => 'drupal_get_form',
  340. 'page arguments' => array('tripal_custom_tables_form', 4),
  341. 'access arguments' => array('administer tripal'),
  342. 'type' => MENU_CALLBACK,
  343. );
  344. $items['admin/tripal/schema/custom_tables/action/%/%'] = array(
  345. 'title' => 'Create Custom Table',
  346. 'description' => 'Custom tables are added to Chado.',
  347. 'page callback' => 'tripal_custom_tables_action',
  348. 'page arguments' => array(4, 5, "1"),
  349. 'access arguments' => array('administer tripal'),
  350. 'type' => MENU_CALLBACK,
  351. );
  352. $items['admin/tripal/schema/custom_tables/views/tables/enable'] = array(
  353. 'title' => 'Enable Custom Tables Administrative View',
  354. 'page callback' => 'tripal_views_admin_enable_view',
  355. 'page arguments' => array('tripal_core_admin_custom_table', 'admin/tripal/schema/custom_tables'),
  356. 'access arguments' => array('administer tripal'),
  357. 'type' => MENU_CALLBACK,
  358. );
  359. // Relationshi API autocomplete callback
  360. $items['tripal_ajax/relationship_nodeform/%/%/name_to_id'] = array(
  361. 'page callback' => 'chado_node_relationships_name_to_id_callback',
  362. 'page arguments' => array(2,3),
  363. 'access arguments' => array('access content'),
  364. 'type' => MENU_CALLBACK
  365. );
  366. return $items;
  367. }
  368. /**
  369. * Set the permission types that the chado module uses. Essentially we
  370. * want permissionis that protect creation, editing and deleting of chado
  371. * data objects
  372. *
  373. * @ingroup tripal_core
  374. */
  375. function tripal_core_permission() {
  376. return array(
  377. 'install chado' => array(
  378. 'title' => t('Install Chado'),
  379. 'description' => t('Allow the user to install or upgrade a Chado database in the existing Drupal database.')
  380. ),
  381. 'administer tripal' => array(
  382. 'title' => t('Administer Tripal'),
  383. 'description' => t('Allow the user to access administrative pages of Tripal.')
  384. ),
  385. );
  386. }
  387. /**
  388. * Implements hook_theme().
  389. * Registers template files/functions used by this module.
  390. *
  391. * @ingroup tripal_core
  392. */
  393. function tripal_core_theme($existing, $type, $theme, $path) {
  394. return array(
  395. 'tripal_core_customize' => array(
  396. 'arguments' => array('job_id' => NULL),
  397. 'template' => 'tripal_core_customize',
  398. 'path' => "$path/theme"
  399. ),
  400. 'theme_file_upload_combo' => array(
  401. 'render element' => 'element',
  402. ),
  403. 'theme_sequence_combo' => array(
  404. 'render element' => 'element',
  405. ),
  406. 'tripal_core_jobs_help' => array(
  407. 'template' => 'tripal_core_jobs_help',
  408. 'variables' => array(NULL),
  409. 'path' => "$path/theme"
  410. ),
  411. 'tripal_core_customtables_help' => array(
  412. 'template' => 'tripal_core_customtables_help',
  413. 'variables' => array(NULL),
  414. 'path' => "$path/theme"
  415. ),
  416. // Chado Node API Themes
  417. // --------------------------------
  418. // Properties Node Form
  419. 'chado_node_properties_form_table' => array(
  420. 'function' => 'theme_chado_node_properties_form_table',
  421. 'render element' => 'element',
  422. ),
  423. // Additional Dbxrefs Nore Form
  424. 'chado_node_additional_dbxrefs_form_table' => array(
  425. 'function' => 'theme_chado_node_additional_dbxrefs_form_table',
  426. 'render element' => 'element',
  427. ),
  428. // Relationships Nore Form
  429. 'chado_node_relationships_form_table' => array(
  430. 'function' => 'theme_chado_node_relationships_form_table',
  431. 'render element' => 'element',
  432. ),
  433. // Admin messages theme
  434. // --------------------------------
  435. 'tripal_admin_message' => array(
  436. 'function' => 'theme_tripal_admin_message',
  437. 'variables' => array('message' => NULL),
  438. )
  439. );
  440. }
  441. /**
  442. * Implements hook_job_describe_args().
  443. * Describes the arguements for the tripal_update_mview job to allow for greater
  444. * readability in the jobs details pages.
  445. *
  446. * @param $callback
  447. * The callback of the current tripal job (this is the function that will be executed
  448. * when tripal_launch_jobs.php is run.
  449. * @param $args
  450. * An array of arguments passed in when the job was registered.
  451. *
  452. * @return
  453. * A more readable $args array
  454. *
  455. * @ingroup tripal_core
  456. */
  457. function tripal_core_job_describe_args($callback, $args) {
  458. $new_args = array();
  459. if ($callback == 'tripal_update_mview') {
  460. // get this mview details
  461. $sql = "SELECT * FROM {tripal_mviews} WHERE mview_id = :mview_id ";
  462. $results = db_query($sql, array(':mview_id' => $args[0]));
  463. $mview = $results->fetchObject();
  464. $new_args['View Name'] = $mview->name;
  465. }
  466. elseif ($callback == 'tripal_core_install_chado') {
  467. $new_args['Action'] = $args[0];
  468. }
  469. return $new_args;
  470. }
  471. /**
  472. * this is just a wrapper for backwards compatibility with a naming mistake.
  473. * it can go away in the future as it only is useful for jobs created by v0.3b
  474. *
  475. * @todo remove this function
  476. */
  477. function tripal_core_load_gff3($gff_file, $organism_id, $analysis_id, $add_only = 0,
  478. $update = 0, $refresh = 0, $remove = 0, $job = NULL) {
  479. tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id, $add_only,
  480. $update, $refresh, $remove, $job);
  481. }
  482. /**
  483. * Implements hook_coder_ignore().
  484. * Defines the path to the file (tripal_core.coder_ignores.txt) where ignore rules for coder are stored
  485. */
  486. function tripal_core_coder_ignore() {
  487. return array(
  488. 'path' => drupal_get_path('module', 'tripal_core'),
  489. 'line prefix' => drupal_get_path('module', 'tripal_core'),
  490. );
  491. }
  492. /**
  493. * Implements hook_views_api()
  494. * Purpose: Essentially this hook tells drupal that there is views support for
  495. * for this module which then includes tripal_db.views.inc where all the
  496. * views integration code is
  497. *
  498. * @ingroup tripal_organism
  499. */
  500. function tripal_core_views_api() {
  501. return array(
  502. 'api' => 3.0,
  503. );
  504. }
  505. /**
  506. * After the node is built, we want to add instructions to each
  507. * content section letting the administrator know which template
  508. * they can customize
  509. *
  510. * @param unknown $build
  511. */
  512. function tripal_core_node_view_alter(&$build) {
  513. global $theme;
  514. $cache = cache_get("theme_registry:$theme", 'cache');
  515. $node = $build['#node'];
  516. // if we are looking at a Tripal node template then we want to
  517. // make some changes to each block of content so that we can associate
  518. // a table of contents and add administrator and curator messages
  519. if (preg_match('/chado_/', $node->type)) {
  520. // iterate through all the elements of the $build array and for those
  521. // with a '#value' add some extra <div> tags
  522. foreach ($build as $key => $value) {
  523. // only examine elements without a '#' prefix
  524. if (!preg_match('/^#/', $key)) {
  525. // get the template path
  526. $path = '';
  527. if (array_key_exists($key, $cache->data) and array_key_exists('path', $cache->data[$key])) {
  528. $path = $cache->data[$key]['path'] . '/' . $key . '.tpl.php';
  529. $path = theme('tripal_admin_message', array('message' => "Administrators, you can
  530. customize the way the content above is presented. Tripal provides a template
  531. file for each block of content. To customize, copy the template file to your
  532. site's default theme and edit. Currently, the content above is provided by
  533. this template:
  534. <br><br>$path
  535. "));
  536. }
  537. // if this element has a #value child then add our div box
  538. if (array_key_exists('#value', $build[$key])) {
  539. $build[$key]['#value'] = "
  540. <div id=\"$key-tripal-data-block\" class=\"tripal-data-block\">" .
  541. $build[$key]['#value'] .
  542. $path .
  543. "</div>";
  544. }
  545. }
  546. }
  547. }
  548. //dpm($build);
  549. //dpm($cache);
  550. }