Plugins Hooks Basics Introduction to Concepts and Basic
Plugins & Hooks (Basics) 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 (vs. External Modules) • Plugins… – Are PHP scripts external to REDCap – Can appear as if part of REDCap (but are not) – Cannot affect behavior or look of existing REDCap pages • Hooks… – Are PHP scripts executed internally by REDCap in specific places in the application – Can affect behavior or look of REDCap pages • External Modules… (coming soon) – Are the next generation of REDCap plugins and hooks – Are kind of a hybrid of plugins and hooks – Will be able to be downloaded from the external modules “app store” and enabled by a REDCap administrator on a given project
Hooks vs. Plugins (vs. External Modules) • 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 data entry forms, survey pages, or during a “save record” event • External Module examples – @NONEOFTHEABOVE action tag hook – Email On Condition module (similar to Auto-Notify plugin)
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 with Kyle
- Slides: 7