Plugins Hooks Introduction to Concepts and Basic Examples
Plugins & Hooks Introduction to Concepts and Basic Examples Rob Taylor Lead Developer · REDCap Development Team Kyle Mc. Guffin Senior Application Developer · Vanderbilt Data Core Team
REDCap is… • Data management platform – Collecting data – Administering surveys – And more • Developer platform – Plugins and Hooks are used to extend REDCap’s capabilities for customization purposes without modifying the REDCap base code – Documentation for Hooks and Plugins is found on left-hand menu of your Control Center in REDCap
Hooks vs. Plugins… – Are PHP scripts/pages that are external to REDCap – Can appear as if part of REDCap (but are not) – Cannot affect behavior or look of existing REDCap pages – Use REDCap’s built-in authentication – Are commonly accessed via Project Bookmarks
Hooks vs. Plugins Hooks… – Are PHP functions executed internally by REDCap in specific places in the application – Can affect behavior and look of REDCap pages • Can replace whole pages, if you wish. Some projects may actually use both plugins and hooks.
Hooks vs. Plugins (cont’d) • Plugin examples – Extra page in a REDCap project – Simple dashboards and reports – Entire web applications that sit on top of REDCap • Hook examples – Customize a survey page, data entry form, etc. – Perform additional back-end operations on any given page, during a “save record” event, etc.
SDK Developer methods for Plugins & Hooks REDCap: : allow. Projects REDCap: : allow. Users REDCap: : email REDCap: : escape. Html REDCap: : filter. Html REDCap: : get. Copyright REDCap: : get. Data. Dictionary REDCap: : get. Event. Id. From. Unique. Event REDCap: : get. Event. Names REDCap: : get. Export. Field. Names REDCap: : get. Field. Type REDCap: : get. Group. Names REDCap: : get. Instrument. Names REDCap: : get. PDF REDCap: : get. Participant. Email REDCap: : get. Participant. List REDCap: : get. Project. Title REDCap: : get. Project. XML REDCap: : get. Record. Id. Field REDCap: : get. Survey. Link REDCap: : get. Survey. Queue. Link REDCap: : get. Survey. Return. Code REDCap: : get. User. Rights REDCap: : get. Users REDCap: : is. Longitudinal REDCap: : log. Event REDCap: : save. Data REDCap: : version. Compare
Hook functions redcap_add_edit_records_page redcap_control_center redcap_custom_verify_username redcap_data_entry_form_top redcap_every_page_before_render redcap_every_page_top redcap_project_home_page redcap_save_record redcap_survey_complete redcap_survey_page_top redcap_user_rights
Demos & Examples
- Slides: 8