Created
April 20, 2011 13:53
-
-
Save lsolesen/931386 to your computer and use it in GitHub Desktop.
mp_calc.module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Implementation of hook_filter_info(). | |
| */ | |
| function mp_run_calc_filter_info() { | |
| $filters['mp_run_calc_filter'] = array( | |
| 'title' => t('Motionsplan - Input filter to show forms in nodes'), | |
| 'description' => t('Substitutes [motionsplan:form_name] tags with the a form from the module.'), | |
| 'process callback' => 'mp_run_calc_filter_process', | |
| 'tips callback' => 'mp_run_calc_filter_tips', | |
| 'cache' => TRUE, | |
| ); | |
| return $filters; | |
| } | |
| /** | |
| * Process callback for hook_filter_info(). | |
| */ | |
| function mp_run_calc_filter_process($text, $filter, $format) { | |
| return preg_replace_callback('@\[motionsplan:(\d+)?\]@', '_mp_run_calc_display_embed', $text); | |
| } | |
| /** | |
| * Implements hook_filter_tips(). | |
| */ | |
| function mp_run_calc_filter_tips($filter, $format, $long = FALSE) { | |
| return t('Use [motionsplan:form-name] to embed the form'); | |
| } | |
| /** | |
| * Display a form by replacing the text. | |
| */ | |
| function _mp_run_calc_display_embed($matches) { | |
| $data['formname'] = $matches[1]; | |
| return implode("\n", $data); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment