tripal_example.admin.inc 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. /**
  3. * @file
  4. * This file contains the functions used for administration of the module
  5. *
  6. */
  7. function tripal_example_admin_examples_listing() {
  8. $output = '';
  9. // set the breadcrumb
  10. $breadcrumb = array();
  11. $breadcrumb[] = l('Home', '<front>');
  12. $breadcrumb[] = l('Administration', 'admin');
  13. $breadcrumb[] = l('Tripal', 'admin/tripal');
  14. $breadcrumb[] = l('Chado', 'admin/tripal/chado');
  15. $breadcrumb[] = l('Examples', 'admin/tripal/chado/tripal_example');
  16. drupal_set_breadcrumb($breadcrumb);
  17. // EXPLANATION: Typically for all Tripal modules the home administrative
  18. // page for the module contains a search form to help the adminstrator
  19. // locate records. The following example code adds a default View to
  20. // the page
  21. /*
  22. // Add the view
  23. $view = views_embed_view('tripal_example_admin_examples','default');
  24. if (isset($view)) {
  25. $output .= $view;
  26. }
  27. else {
  28. $output .= '<p>The Tripal Example Module uses primarily views to provide an '
  29. . 'administrative interface. Currently one or more views needed for this '
  30. . 'administrative interface are disabled. <strong>Click each of the following links to '
  31. . 'enable the pertinent views</strong>:</p>';
  32. $output .= '<ul>';
  33. $output .= '<li>'.l('Example Admin', 'admin/tripal/chado/tripal_example/views/examples/enable').'</li>';
  34. $output .= '</ul>';
  35. }
  36. */
  37. $output = 'Typically a search view goes here';
  38. return $output;
  39. }
  40. /**
  41. * Administrative settings form
  42. *
  43. * @ingroup tripal_example
  44. */
  45. function tripal_example_admin() {
  46. $form = array();
  47. $form['nothing'] = array(
  48. '#markup' => t('There are currently no settings to configure.')
  49. );
  50. // If your module is using the Chado Node: Title & Path API to allow custom titles
  51. // for your node type then you need to add the configuration form for this functionality.
  52. $details = array(
  53. 'module' => 'tripal_example', // the name of the MODULE implementing the content type
  54. // An array of options to use under "Page Titles"
  55. // the key should be the token and the value should be the human-readable option
  56. 'options' => array(
  57. '[example.name]' => 'Germplasm Name Only',
  58. '[example.uniquename]' => 'Germplasm Unique Name Only',
  59. // there should always be one options matching the unique constraint.
  60. // If you have a more human-readable constraint, then that is preferrable.
  61. // See the tripal feature module for a good example of this.
  62. '[example.example_id]' => 'Unique Contraint: The Chado ID for Examples'
  63. ),
  64. // the token indicating the unique constraint in the options array
  65. 'unique_option' => '[example.example_id]'
  66. );
  67. // This call adds the configuration form to your current form
  68. // This sub-form handles it's own validation & submit
  69. chado_add_admin_form_set_title($form, $form_state, $details);
  70. return system_settings_form($form);
  71. }
  72. /**
  73. *
  74. * @ingroup tripal_example
  75. */
  76. function tripal_example_admin_validate($form, &$form_state) {
  77. }