hook.api.php

  1. 6.x includes/hook.api.php
  2. 4.x includes/hook.api.php
  3. 5.x includes/hook.api.php

Lists all available hooks within FlightPath's core code.

This script is not meant to be included and used in FlightPath, it is simply for documentation of how the various hooks work.

In each example, you may use a hook by replacing the word "hook" with the name of your custom module.

For example, hook_menu() might be my_module_menu(). FlightPath will automatically begin using the hooks in your module, once the module is enabled.

File

includes/hook.api.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Lists all available hooks within FlightPath's core code.
  5. *
  6. * This script is not meant to be included and used in FlightPath,
  7. * it is simply for documentation of how the various hooks work.
  8. *
  9. * In each example, you may use a hook by replacing the word "hook"
  10. * with the name of your custom module.
  11. *
  12. * For example, hook_menu() might be my_module_menu(). FlightPath
  13. * will automatically begin using the hooks in your module, once the
  14. * module is enabled.
  15. */
  16. /**
  17. * Alter forms which are created using the Form API
  18. *
  19. * @param &$form
  20. * This is the actual form array, retrieved from the form's callback
  21. * function. It should ALWAYS be passed by reference, so that the
  22. * changes you make to it will carry through.
  23. * @param $form_id
  24. * This is the "form_id" of the form-- usually the name of the callback
  25. * function which created the form. It can be used to identify forms
  26. * before you attempt to take action.
  27. *
  28. */
  29. function hook_form_alter(&$form, $form_id) {
  30. if ($form_id == "example_form_callback") {
  31. $form["new_element"] = array(
  32. // ...
  33. );
  34. }
  35. }
  36. /**
  37. * Reports status information which each module is aware of, visible on admin/config/status.
  38. *
  39. * This allows modules to let the user know about requirements which are not being met, or
  40. * simply to let them know that someting is working successfully.
  41. *
  42. * For example, you may want to let the user know that a nightly job failed to run the night before.
  43. *
  44. * @return array()
  45. * - severity: "normal", "warning", and "alert" are the choices.
  46. * - status: A short message.
  47. *
  48. */
  49. function hook_status() {
  50. // Example from system.module, reporting on if Cron has run recently:
  51. $rtn = array();
  52. $rtn["severity"] = "normal";
  53. // Check on the last time cron was run; make sure it's working properly.
  54. $last_run = variable_get("cron_last_run", 0);
  55. if ($last_run < strtotime("-2 DAY")) {
  56. $rtn["severity"] = "alert";
  57. $rtn["status"] .= t("Cron hasn't run in over 2 days. For your installation of FlightPath
  58. to function properly, cron.php must be accessed routinely. At least once per day is recommended.");
  59. }
  60. else {
  61. $rtn["status"] .= t("Cron was last run on %date", array("%date" => format_date($last_run)));
  62. }
  63. $rtn["status"] .= "<p style='font-size: 0.8em;'>" . t("Your site's cron URL is:");
  64. $rtn["status"] .= "<br>&nbsp; &nbsp; <i>" . $GLOBALS["fp_system_settings"]["base_url"] . "/cron.php?t=" . $GLOBALS["fp_system_settings"]["cron_security_token"] . "</i>
  65. <br>" . t("Example linux cron command:") . "&nbsp; <i>wget -O - -q -t 1 http://ABOVE_URL</i>";
  66. $rtn["status"] .= "</p>";
  67. return $rtn;
  68. }
  69. /**
  70. * Validates form submissions from the Form API
  71. *
  72. * This function can be named anything you want (or can be considered optional).
  73. * If named the same thing as the form callback, it will be utilized automatically.
  74. * For example, if you form is named my_form, then if you have a validate function
  75. * named my_form_validate, it will be called automatically.
  76. *
  77. * Since $form_state is passed by reference, you may make changes to this array, and
  78. * those changes will carry through to other validate functions (defined with #validate_handlers)
  79. * and then to the submit handler(s).
  80. *
  81. * @see hook_submit($form, &$form_state)
  82. */
  83. function hook_validate($form, &$form_state) {
  84. $age = $form_state["values"]["age"];
  85. if ($age < 18) {
  86. form_error("age", "Sorry, you must be 18 or older to submit this form.");
  87. return;
  88. }
  89. }
  90. /**
  91. * This hook is called every time the system cron is run.
  92. *
  93. * Modules should place code here which is meant to be run on a schedule.
  94. */
  95. function hook_cron() {
  96. // Example: check for students who have dropped, and email their advisors.
  97. }
  98. /**
  99. * Handle submissions from the Form API
  100. *
  101. * Like hook_validate, this function (if it exists) is called after you submit a form,
  102. * and after the validation completes without errors. This is where you should act on
  103. * the submission, confident that it has passed validation, and the values in $form_state
  104. * are in the final state.
  105. *
  106. * @see hook_validate($form, &$form_state)
  107. */
  108. function hook_submit($form, &$form_state) {
  109. $values = $form_state["values"];
  110. db_query("INSERT INTO example (f_name) ('?') ", $values["name"]);
  111. }
  112. /**
  113. * This hook will be executed the first time a module is enabled in the system.
  114. *
  115. * It is expected to go in a PHP file named [module].install. Ex: system.install
  116. *
  117. * @see hook_enable()
  118. * @see hook_disable()
  119. * @see hook_update($old_schema, $new_schema)
  120. * @see hook_uninstall()
  121. */
  122. function hook_install() {
  123. // Perform installation functions.
  124. db_query("CREATE TABLE ...... ");
  125. }
  126. /**
  127. * This hook will be executed when a module is enabled in the system. It will be
  128. * executed AFTER hook_install.
  129. *
  130. * It is expected to go in a PHP file named [module].install. Ex: system.install
  131. *
  132. * @see hook_install()
  133. * @see hook_disable()
  134. * @see hook_update($old_schema, $new_schema)
  135. * @see hook_uninstall()
  136. */
  137. function hook_enable() {
  138. fp_add_message("Don't forget to go to settings...");
  139. }
  140. /**
  141. * This hook will be executed when a module is disabled in the system.
  142. *
  143. * It is expected to go in a PHP file named [module].install. Ex: system.install
  144. *
  145. * @see hook_install()
  146. * @see hook_enable()
  147. * @see hook_update($old_schema, $new_schema)
  148. * @see hook_uninstall()
  149. */
  150. function hook_disable() {
  151. fp_add_message("Sorry to see you go!");
  152. }
  153. /**
  154. * This hook will be executed when a module is "uninstalled" in the system. Once
  155. * a module is disabled, an "uninstall" link will appear.
  156. *
  157. * It is expected to go in a PHP file named [module].install. Ex: system.install
  158. *
  159. * @see hook_install()
  160. * @see hook_enable()
  161. * @see hook_update($old_schema, $new_schema)
  162. * @see hook_disable()
  163. */
  164. function hook_uninstall() {
  165. db_query("DROP TABLE mycustomtable ... ");
  166. }
  167. /**
  168. * This hook will be executed when a module is "updated" in the system. If the system
  169. * sees that the schema version defined in the .info file is different than the one
  170. * in the database for that module, an update link will appear.
  171. *
  172. * It is expected to go in a PHP file named [module].install. Ex: system.install
  173. *
  174. * @see hook_install()
  175. * @see hook_enable()
  176. * @see hook_uninstall()
  177. * @see hook_disable()
  178. */
  179. function hook_update($old_schema, $new_schema) {
  180. if ($old_schema < 5) {
  181. db_query("ALTER TABLE ...... ");
  182. }
  183. }
  184. /**
  185. * Handle needed database updates when user updates a module.
  186. *
  187. * Modules can specify which schema their tables are using in their .info file.
  188. * if the module, in a later version, changes the table it writes to, it should increment
  189. * the schema number, whic causes the user to be notified (on the modules page) that they need
  190. * to run the DB updates.
  191. *
  192. * When the DB updates are run, every module implementing this function will be called
  193. * (it is expected to be in a .install file, instead of the .module file, though both get
  194. * included by the system first).
  195. *
  196. * In this function, the developer can see what schema they are coming FROM, and make table
  197. * or other alterations based on that information.
  198. *
  199. * @param $old_schema
  200. * This will be the schema value we are upgrading FROM. Ex: 0, 1, 17, etc.
  201. * @param $new_schema
  202. * This is the new schema value in the module's .info file, that
  203. * we are upgrading to. Ex: 2, 18, etc.
  204. *
  205. */
  206. function hook_update($old_schema, $new_schema) {
  207. if ($new_schema < 4) {
  208. db_query("ALTER TABLE my_example_table ...... ");
  209. }
  210. }
  211. /**
  212. * Allows each module to perform actions when the cache is cleared.
  213. *
  214. * If your custom module needs to clear its own cache, for example,
  215. * then you should implement this hook and place your module-specific
  216. * code inside.
  217. *
  218. */
  219. function hook_clear_cache() {
  220. db_query("DELETE FROM mymodule_cache_tables WHERE 1");
  221. }
  222. /**
  223. * Allows each module to execute code when the module is first loaded.
  224. *
  225. * Typically, this means that we will execute code when the page is first loaded.
  226. * Also useful for including javascript or CSS on the page, but only under certain
  227. * conditions (like who the user is, or what permissions they have)
  228. *
  229. * @see hook_exit
  230. */
  231. function hook_init() {
  232. // Perform actions when page is loaded...
  233. if (user_has_access("some_permission")) {
  234. $GLOBALS["some_variable"] = TRUE;
  235. }
  236. }
  237. /**
  238. * Allows each module to execute code when the FlightPath page is completely finished.
  239. *
  240. * Be aware that theming and themable functions will not work, since this hook is called
  241. * after the page has been completely rendered. If you need to output debug statements for yourself,
  242. * use echo or print, and it will be at the BOTTOM of the page.
  243. *
  244. * @see hook_init
  245. */
  246. function hook_exit() {
  247. // ex: Close outside db connections
  248. // ex: print "Time for page to load:" . $ctime;
  249. }
  250. /**
  251. * Perform actions when the user logs in successfully.
  252. *
  253. * Notice that $account is passed by reference. You may make whatever changes
  254. * you wish to this object.
  255. */
  256. function hook_user_login(&$account) {
  257. if ($account->uid = 9) {
  258. $account->this_is_jeff = TRUE;
  259. }
  260. }
  261. /**
  262. * This hook defines available permissions for a module.
  263. * These perms are used with hook_menu() and the function user_has_permission()
  264. *
  265. * They are defined in the form of an associative array.
  266. *
  267. * Return array should look like this:
  268. * $rtn["machine_name_of_perm"] = array(
  269. * "title" => "Human readable title for perm",
  270. * "description" => "Optional longer description of what perm allows.",
  271. * );
  272. *
  273. * @return array
  274. *
  275. * @see hook_menu()
  276. * @see user_has_permission()
  277. *
  278. */
  279. function hook_perm() {
  280. // An example from system.module:
  281. $perms = array (
  282. "access_logged_in_content" => array(
  283. "title" => t("Access logged-in content"),
  284. "description" => t("This should be given to all authenticated users. It simply means
  285. the user is allowed to view the logged-in area of FlightPath."),
  286. ),
  287. "administer_modules" => array(
  288. "title" => t("Administer modules"),
  289. "description" => t("This will allow a user to install, enable, disable, and uninstall modules."),
  290. ),
  291. "run_cron" => array(
  292. "title" => t("Run Cron"),
  293. "description" => t("The user may run hook_cron functions at will. Causes a new menu link to appear
  294. on the admin page."),
  295. ),
  296. "de_can_administer_system_settings" => array(
  297. "title" => t("Can administer system settings"),
  298. "description" => t("This allows the user to edit any of the FlightPath
  299. system settings."),
  300. ),
  301. "view_fpm_debug" => array(
  302. "title" => t("View debug output from the fpm() function"),
  303. "description" => t("The user may view debug output from the fpm() function.
  304. Useful for developers."),
  305. ),
  306. );
  307. return $perms;
  308. }
  309. /**
  310. * Allows modules to hook in after a new student object is created.
  311. *
  312. * This is so that modules can modify student objects (including what courses they
  313. * have taken) when that student object is first created. For example, if you need
  314. * to query extra databases to get all of a student's credits.
  315. */
  316. function hook_student_load(&$student) {
  317. if ($student->gpa > 3) {
  318. $student->deans_list = TRUE;
  319. }
  320. }
  321. /**
  322. * Allows modules to specify valid URLs in FlightPath, and define what function to call
  323. * when the user visits that URL.
  324. *
  325. * After making changes to your hook menu, you <b>must</b> clear the menu cache for FlightPath!
  326. * Otherwise, FlightPath will not be aware of your changes. This can be done on the /admin-tools/admin page.
  327. *
  328. * This function should return an array containing everything FP needs to correctly set up
  329. * the menu item.
  330. *
  331. * First, the index of the array should be the URL itself.
  332. * Ex: $items["my/url"] = array(
  333. * ...
  334. * );
  335. *
  336. * The URL is allowed to contain wildcards (%).
  337. * Ex:
  338. * $items["content/%/edit"] = array(...);
  339. *
  340. * The wildcard is in position "1", since the URL pieces begin with zero ("0").
  341. *
  342. * Here are what the inner parts of the array mean:
  343. * - title : The title of the page or menu item. Should not be wrapped in t() function.
  344. * - page_callback: A string which defines the function to call when this URL is accessed.
  345. * - page_arguments: An optional array of arguments to pass to the callback function. May contain numerican references to wildcards in the URL.
  346. * - access_callback: A string which defines a function to call to determine if the user may access this URL.
  347. * Can be set to TRUE if this URL is open to anyone. May be omitted if you simply want to test if the user has a particular
  348. * permission, by only setting access_arguments.
  349. * - access_arguments: An array containing the arguments to pass to the access_callback function. If the access_callback
  350. * function is omitted, it is assumed to be "user_has_permission", in which case you may simply specify
  351. * an array of permissions here. May contain numerican references to wildcards in the URL.
  352. * - type: A constant value describing the type of menu item it is. Examples are:
  353. * - MENU_TYPE_NORMAL_ITEM - A standard menu item. Will output as a link if the URL conforms to certain requirements.
  354. * - MENU_TYPE_CALLBACK - A menu item which will not display itself on any blocks.
  355. * - MENU_TYPE_TAB - A menu item which will output the page it draws with a tab at the top, or part of a tab family.
  356. * - MENU_TYPE_SUB_TAB - This will output the page as a "sub tab" under the main tab. Ex: the student search tab's subtabs, or
  357. * the View tab's Display by Year and Display By Type sub tabs.
  358. * - tab_family: If this menu item is a tab, specifying a machine name for the tab family will group all other tabs
  359. * in that family together, and draw the other tabs in that family at the top of the screen.
  360. * - tab_parent: The *path* of the parent tab for this menu item. Will cause the parent tab's name to be displayed
  361. * as a tab at the top of the page. Ex: "admin-tools/admin"
  362. * - weight: Optional number, for when menu items are being displayed in a block. Smaller weights appear first.
  363. * - file: Path to a file that this menu item's callback is located in.
  364. * - page_settings: This is an optional array which allows for more detailed control over how the menu item and the page
  365. * it draws will look. Ex: "page_settings" => array( //....//); See below:
  366. * - page_has_search: TRUE or FALSE, whether or not the search box will be drawn at the top of the screen. This is the
  367. * search box which searches for students.
  368. * - page_show_title: TRUE if the page should display the title at the top of the content region.
  369. * - page_banner_is_link: TRUE or FALSE. Does the banner at the top of the screen link back to the Main tab. Not implemented right now.
  370. * - page_hide_report_error: TRUE or FALSE. Should the "Contact the FlightPath Production Team" link be shown at the bottom of the screen.
  371. * - page_is_popup: TRUE or FALSE. Whether or not the page is going to be displayed in a popup. Will remove the banner and other
  372. * elements which might not look good in a popup window.
  373. * - display_greeting: TRUE or FALSE. Should the page have the greeting text at the top? Ex: see the Main tab.
  374. * - display_currently_advising: TRUE or FALSE. Should the page display the "Currently Advising" box at the top of the page?
  375. * - screen_mode: If set to "not_advising" while display_currently_advising is set to TRUE, it will not display the options
  376. * to change degree options or advising terms.
  377. * - bool_print: Set to TRUE if this page is meant to be printable (it is formatted to print easily).
  378. * - target: The anchor target of this menu item (if it is drawn in a block). Ex: "_blank"
  379. * - menu_icon: A string which points to an icon to display with this link, if it is being displayed in a block.
  380. * - menu_links: An array of links. This is an array of parameters which would fit very will into the l() function.
  381. * The links will appear as simple links at the top of the page. Will be filtered through hook_menu_handle_replacement_pattern().
  382. * Ex: "menu_links" => array(0 => array("text"=>"link", "path"=>"admin/tools", "query"=>"name=bob"))
  383. * - 0..n
  384. * - text: The text of the link
  385. * - path: The internal path of the link. Ex: "admin-tools/admin"
  386. * - query: Optional query to add to the end of the URL. Ex: "de_catalog_year=%DE_CATALOG_YEAR%"
  387. * Will be filtered through hook_menu_handle_replacement_pattern()
  388. *
  389. *
  390. * See the examples below for demonstrations of typical menu items.
  391. *
  392. * @return array
  393. *
  394. * @see hook_perm()
  395. * @see hook_menu_handle_replacement_pattern()
  396. *
  397. */
  398. function hook_menu() {
  399. // Examples from various modules:
  400. $items = array();
  401. $items["main"] = array(
  402. "title" => "Main",
  403. "page_callback" => "system_display_main_page",
  404. "access_callback" => TRUE,
  405. "type" => MENU_TYPE_TAB,
  406. "tab_family" => "system",
  407. "weight" => 10,
  408. "page_settings" => array(
  409. "display_greeting" => TRUE,
  410. "display_currently_advising" => TRUE,
  411. "screen_mode" => "not_advising",
  412. "page_has_search" => TRUE,
  413. ),
  414. );
  415. $items["login"] = array(
  416. "title" => "Login",
  417. "page_callback" => "system_display_login_page",
  418. "access_callback" => TRUE,
  419. "type" => MENU_TYPE_NORMAL_ITEM,
  420. );
  421. $items["admin-tools/clear-cache"] = array(
  422. "title" => "Clear all cache",
  423. "page_callback" => "system_perform_clear_cache",
  424. "access_arguments" => array("administer_modules"),
  425. "type" => MENU_TYPE_NORMAL_ITEM,
  426. );
  427. $items["admin/db-updates"] = array(
  428. "title" => "Run DB updates?",
  429. "page_callback" => "fp_render_form",
  430. "page_arguments" => array("system_confirm_db_updates_form"),
  431. "access_arguments" => array("administer_modules"),
  432. "type" => MENU_TYPE_NORMAL_ITEM,
  433. );
  434. $items["admin/config/system-settings"] = array(
  435. "title" => "System settings",
  436. "page_callback" => "fp_render_form",
  437. "page_arguments" => array("system_settings_form", "system_settings"),
  438. "access_arguments" => array("de_can_administer_system_settings"),
  439. "page_settings" => array(
  440. "page_has_search" => FALSE,
  441. "page_banner_is_link" => TRUE,
  442. "page_hide_report_error" => TRUE,
  443. "menu_icon" => fp_theme_location() . "/images/toolbox.gif",
  444. "menu_links" => array(
  445. 0 => array(
  446. "text" => "Back to main menu",
  447. "path" => "admin-tools/admin",
  448. "query" => "de_catalog_year=%DE_CATALOG_YEAR%",
  449. ),
  450. ),
  451. ),
  452. "type" => MENU_TYPE_NORMAL_ITEM,
  453. "tab_parent" => "admin-tools/admin",
  454. );
  455. $items["admin-tools/admin"] = array(
  456. "title" => "FlightPath Admin Console",
  457. "page_callback" => "admin_display_main",
  458. "access_arguments" => array("can_access_admin"),
  459. "tab_family" => "admin",
  460. "page_settings" => array(
  461. "page_has_search" => FALSE,
  462. "page_banner_is_link" => TRUE,
  463. "page_hide_report_error" => TRUE,
  464. "target" => "_blank",
  465. ),
  466. "type" => MENU_TYPE_TAB,
  467. );
  468. $items["admin/config/modules"] = array(
  469. "title" => "Modules",
  470. "page_callback" => "fp_render_form",
  471. "page_arguments" => array("system_modules_form"),
  472. "access_arguments" => array("administer_modules"),
  473. "page_settings" => array(
  474. "page_has_search" => FALSE,
  475. "page_banner_is_link" => TRUE,
  476. "page_hide_report_error" => TRUE,
  477. "menu_links" => array(
  478. 0 => array(
  479. "text" => "Back to main menu",
  480. "path" => "admin-tools/admin",
  481. "query" => "de_catalog_year=%DE_CATALOG_YEAR%",
  482. ),
  483. ),
  484. ),
  485. "type" => MENU_TYPE_NORMAL_ITEM,
  486. "tab_parent" => "admin-tools/admin",
  487. );
  488. $items["view/print"] = array(
  489. "title" => "View",
  490. "page_callback" => "advise_display_view",
  491. "page_arguments" => array("view"),
  492. "access_callback" => TRUE,
  493. "page_settings" => array (
  494. "display_currently_advising" => TRUE,
  495. "bool_print" => TRUE,
  496. "screen_mode" => "not_advising",
  497. ),
  498. "type" => MENU_TYPE_CALLBACK,
  499. );
  500. $items["admin/config/clear-menu-cache"] = array(
  501. "title" => "Clear menu cache",
  502. "page_callback" => "system_perform_clear_menu_cache",
  503. "access_arguments" => array("administer_modules"),
  504. "type" => MENU_TYPE_NORMAL_ITEM,
  505. );
  506. $items["system-handle-form-submit"] = array(
  507. "page_callback" => "system_handle_form_submit",
  508. "access_callback" => TRUE,
  509. "type" => MENU_TYPE_CALLBACK,
  510. );
  511. $items["logout"] = array(
  512. "title" => "Logout",
  513. "page_callback" => "system_handle_logout",
  514. "access_callback" => TRUE,
  515. "type" => MENU_TYPE_CALLBACK,
  516. );
  517. $items["popup-report-contact"] = array(
  518. "title" => "Report/Contact",
  519. "page_callback" => "fp_render_form",
  520. "page_arguments" => array("system_popup_report_contact_form"),
  521. "access_callback" => TRUE,
  522. "page_settings" => array(
  523. "page_is_popup" => TRUE,
  524. "page_hide_report_error" => TRUE,
  525. ),
  526. "type" => MENU_TYPE_CALLBACK,
  527. );
  528. $items["popup-contact-form/thank-you"] = array(
  529. "title" => "Report/Contact",
  530. "page_callback" => "system_popup_report_contact_thank_you",
  531. "access_callback" => TRUE,
  532. "page_settings" => array(
  533. "page_is_popup" => TRUE,
  534. "page_hide_report_error" => TRUE,
  535. ),
  536. "type" => MENU_TYPE_CALLBACK,
  537. );
  538. $items["admin/degrees/add-degree"] = array(
  539. "title" => "Add Degree",
  540. "page_callback" => "fp_render_form",
  541. "page_arguments" => array("admin_add_degree_form"),
  542. "access_arguments" => array("can_edit_data_entry"),
  543. "page_settings" => array(
  544. "page_has_search" => FALSE,
  545. "page_banner_is_link" => TRUE,
  546. "page_hide_report_error" => TRUE,
  547. "menu_links" => array(
  548. 0 => array(
  549. "text" => "Back to main menu",
  550. "path" => "admin-tools/admin",
  551. "query" => "de_catalog_year=%DE_CATALOG_YEAR%",
  552. ),
  553. 1 => array(
  554. "text" => "Back to Degrees list",
  555. "path" => "admin/degrees",
  556. "query" => "de_catalog_year=%DE_CATALOG_YEAR%",
  557. ),
  558. ),
  559. ),
  560. "file" => menu_get_module_path("admin") . "/admin.degrees.inc",
  561. "type" => MENU_TYPE_NORMAL_ITEM,
  562. "tab_parent" => "admin/degrees",
  563. );
  564. $items["admin/config/content"] = array(
  565. "title" => "Content",
  566. "page_callback" => "content_display_content_admin_list",
  567. "access_arguments" => array("admin_content"),
  568. "page_settings" => array(
  569. "page_has_search" => FALSE,
  570. "page_show_title" => TRUE,
  571. "page_banner_is_link" => TRUE,
  572. "page_hide_report_error" => TRUE,
  573. "menu_links" => array(
  574. 0 => array(
  575. "text" => "Back to main menu",
  576. "path" => "admin-tools/admin",
  577. "query" => "de_catalog_year=%DE_CATALOG_YEAR%",
  578. ),
  579. ),
  580. ),
  581. "type" => MENU_TYPE_TAB,
  582. "tab_family" => "content_list",
  583. );
  584. $items["content/%"] = array(
  585. "page_callback" => "content_view_content",
  586. "page_arguments" => array(1),
  587. "access_callback" => "content_user_access",
  588. "access_arguments" => array("view_cid", 1),
  589. "page_settings" => array(
  590. "page_has_search" => FALSE,
  591. "page_show_title" => TRUE,
  592. "page_banner_is_link" => TRUE,
  593. "page_hide_report_error" => TRUE,
  594. "menu_links" => array(
  595. 0 => array(
  596. "text" => "Edit this content",
  597. "path" => "content/%CONTENT_CID%/edit",
  598. "query" => "",
  599. ),
  600. ),
  601. ),
  602. "type" => MENU_TYPE_TAB,
  603. "tab_parent" => "admin/config/content",
  604. );
  605. $items["content/%/edit"] = array(
  606. "page_callback" => "fp_render_form",
  607. "page_arguments" => array("content_edit_content_form", "", "", 1),
  608. "access_callback" => "content_user_access",
  609. "access_arguments" => array("edit_cid", 1),
  610. "page_settings" => array(
  611. "page_has_search" => FALSE,
  612. "page_banner_is_link" => TRUE,
  613. "page_hide_report_error" => TRUE,
  614. "menu_links" => array(
  615. 0 => array(
  616. "text" => "Back to main menu",
  617. "path" => "admin-tools/admin",
  618. "query" => "de_catalog_year=%DE_CATALOG_YEAR%",
  619. ),
  620. 1 => array(
  621. "text" => "Back to content list",
  622. "path" => "admin/config/content",
  623. "query" => "de_catalog_year=%DE_CATALOG_YEAR%",
  624. ),
  625. ),
  626. ),
  627. "type" => MENU_TYPE_TAB,
  628. "tab_parent" => "admin/config/content",
  629. );
  630. return $items;
  631. }
  632. /**
  633. * This hook is called by the menu system. It allows each module
  634. * the change to replace string patterns in its menu items (defined in hook_menu).
  635. *
  636. * @see hook_menu()
  637. */
  638. function hook_menu_handle_replacement_pattern($str) {
  639. /*
  640. * This example, from admin.module, will replace the pattern %DE_CATALOG_YEAR%
  641. * with the actual current catalog year in the system.
  642. *
  643. * An example menu item which uses this replacement pattern would be this:
  644. * $items["admin/config/urgent-message"] = array(
  645. * "title" => "Edit urgent message",
  646. * "page_callback" => "fp_render_form",
  647. * "page_arguments" => array("admin_urgent_message_form", "system_settings"),
  648. * "access_arguments" => array("can_edit_urgent_message"),
  649. * "page_settings" => array(
  650. * "page_has_search" => FALSE,
  651. * "page_banner_is_link" => TRUE,
  652. * "page_hide_report_error" => TRUE,
  653. * "menu_links" => array(
  654. * 0 => array(
  655. * "text" => "Back to main menu",
  656. * "path" => "admin-tools/admin",
  657. * "query" => "de_catalog_year=%DE_CATALOG_YEAR%", // RIGHT HERE!
  658. * ),
  659. * ),
  660. * ),
  661. * "type" => MENU_TYPE_NORMAL_ITEM,
  662. * "tab_parent" => "admin-tools/admin",
  663. * );
  664. *
  665. */
  666. if (strpos($str, "%DE_CATALOG_YEAR%") !== 0) {
  667. // It contains this replacement pattern!
  668. $str = str_replace("%DE_CATALOG_YEAR%", admin_get_de_catalog_year(), $str);
  669. }
  670. return $str;
  671. }
  672. /**
  673. * This hook allows modules to perform extra functions just after an advising
  674. * session is saved by the system.
  675. *
  676. * The main advising form (on the View and What If tabs) are currently _not_ defined
  677. * through the system's form API. Therefore, a simple hook_submit wouldn't be possible.
  678. *
  679. * This hook was created to bridge that gap, until the advising form can be brought into
  680. * the form API (possibly by 5.x)
  681. *
  682. * @param $adv_id_array
  683. * Since this hook is called immediately after submitting the advising session,
  684. * this array will contain the database ID's to the rows added to the advising_sessions table.
  685. *
  686. */
  687. function hook_save_advising_session($adv_id_array) {
  688. foreach ($adv_id_array as $id) {
  689. // Perform extra actions on those advising sessions.
  690. }
  691. // Example functions:
  692. // Email student a copy of what was just advised for them to take.
  693. // Maybe lift an advising flag in the mainframe system?
  694. }

Functions

Namesort descending Description
hook_clear_cache Allows each module to perform actions when the cache is cleared.
hook_cron This hook is called every time the system cron is run.
hook_disable This hook will be executed when a module is disabled in the system.
hook_enable This hook will be executed when a module is enabled in the system. It will be executed AFTER hook_install.
hook_exit Allows each module to execute code when the FlightPath page is completely finished.
hook_form_alter Alter forms which are created using the Form API
hook_init Allows each module to execute code when the module is first loaded.
hook_install This hook will be executed the first time a module is enabled in the system.
hook_menu Allows modules to specify valid URLs in FlightPath, and define what function to call when the user visits that URL.
hook_menu_handle_replacement_pattern This hook is called by the menu system. It allows each module the change to replace string patterns in its menu items (defined in hook_menu).
hook_perm This hook defines available permissions for a module. These perms are used with hook_menu() and the function user_has_permission()
hook_save_advising_session This hook allows modules to perform extra functions just after an advising session is saved by the system.
hook_status Reports status information which each module is aware of, visible on admin/config/status.
hook_student_load Allows modules to hook in after a new student object is created.
hook_submit Handle submissions from the Form API
hook_uninstall This hook will be executed when a module is "uninstalled" in the system. Once a module is disabled, an "uninstall" link will appear.
hook_update Handle needed database updates when user updates a module.
hook_user_login Perform actions when the user logs in successfully.
hook_validate Validates form submissions from the Form API