| @@ -1,8 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | //if accessed directly exit |
| 3 | 3 | if(!defined( 'ABSPATH' )) exit; |
| 4 | 4 | |
| 5 | +use FluentBoards\App\Hooks\Handlers\RestLocaleHandler; | |
| 6 | + | |
| 5 | 7 | /** |
| 6 | 8 | * All registered filter's handlers should be in app\Hooks\Handlers, |
| 7 | 9 | * addFilter is similar to add_filter and addCustomFilter is just a |
| 8 | 10 | * wrapper over add_filter which will add a prefix to the hook name |
| @@ -18,4 +20,12 @@ | ||
| 18 | 20 | $app->addCustomFilter('ajax_options_non_board_wordpress_users', 'TaskHandler@searchNonBoardWordpressUsers', 10, 3); |
| 19 | 21 | $app->addCustomFilter('ajax_options_crm_contacts', 'TaskHandler@searchContact', 10, 3); |
| 20 | 22 | $app->addCustomFilter('task_attachment_file_upload', 'FileHandler@handleUpload', 10, 1); |
| 21 | 23 | $app->addCustomFilter('wp_editor_media_file_upload', 'FileHandler@handleMediaFileUpload', 10, 1 ); |
| 24 | +$app->addCustomFilter('board_find', 'BoardHandler@attachFolderToBoard', 10, 1); | |
| 25 | + | |
| 26 | +$restLocaleHandler = new RestLocaleHandler( | |
| 27 | + $app->config->get('app.rest_namespace'), | |
| 28 | + $app->config->get('app.rest_version') | |
| 29 | +); | |
| 30 | +$app->addFilter('rest_request_before_callbacks', [$restLocaleHandler, 'switchToUserLocale'], 1, 3); | |
| 31 | +$app->addFilter('rest_request_after_callbacks', [$restLocaleHandler, 'restoreLocale'], PHP_INT_MAX, 3); | |