@@ -41,8 +41,6 @@ public function register($category, $path, $mainContextId = null)
4141
4242 if ($ success && $ this ->getEnabled ($ mainContextId )) {
4343 Hook::add ('Form::config::after ' , [$ this , 'editFormComponents ' ]);
44- Hook::add ('preprintgalleyform::display ' , [$ this , 'modifyGalleyForm ' ]);
45- Hook::add ('preprintgalleyform::validate ' , [$ this , 'modifyGalleyFormValidation ' ]);
4644 Hook::add ('TemplateManager::display ' , [$ this , 'modifySubmissionSteps ' ]);
4745 Hook::add ('Submission::validateSubmit ' , [$ this , 'validateSubmissionFields ' ]);
4846 Hook::add ('Template::SubmissionWizard::Section::Review ' , [$ this , 'modifyReviewSections ' ]);
@@ -166,52 +164,6 @@ private function removePrefixAndSubtitleFields($formConfig)
166164 return $ formConfig ;
167165 }
168166
169- public function modifyGalleyForm ($ hookName , $ params )
170- {
171- $ request = Application::get ()->getRequest ();
172- $ templateMgr = TemplateManager::getManager ($ request );
173-
174- $ templateMgr ->registerFilter ("output " , [$ this , 'removeFieldsFromGalleyFormFilter ' ]);
175- }
176-
177- public function removeFieldsFromGalleyFormFilter ($ output , $ templateMgr )
178- {
179- if (preg_match ('/id="preprintGalleyForm"/ ' , $ output )) {
180- preg_match ('/<\/form>/ ' , $ output , $ matches , PREG_OFFSET_CAPTURE );
181-
182- $ posMatch = $ matches [0 ][1 ];
183- $ removeGalleyFields = $ templateMgr ->fetch ($ this ->getTemplateResource ('removeGalleyFields.tpl ' ));
184- $ output = substr_replace ($ output , $ removeGalleyFields , $ posMatch , 0 );
185-
186- $ templateMgr ->unregisterFilter ('output ' , array ($ this , 'removeFieldsFromGalleyFormFilter ' ));
187- }
188-
189- return $ output ;
190- }
191-
192- public function modifyGalleyFormValidation ($ hookName , $ params )
193- {
194- $ form = &$ params [0 ];
195- $ submission = $ form ->_submission ;
196-
197- if (!empty ($ submission ->getData ('submissionProgress ' ))) {
198- return Hook::CONTINUE ;
199- }
200-
201- $ checker = new ScreeningChecker ();
202- $ galleys = $ submission ->getGalleys ();
203- $ galleysFiletypes = array_map (function ($ galley ) {
204- return ($ galley ->getFileType ());
205- }, $ galleys );
206-
207- if ($ checker ->checkNumberPdfs ($ galleysFiletypes )[0 ]) {
208- $ form ->addErrorField ('preprintGalleyFormNotification ' );
209- $ form ->addError ('preprintGalleyFormNotification ' , __ ("plugins.generic.scieloScreening.screeningRules.numPdfs " ));
210- }
211-
212- return Hook::CONTINUE ;
213- }
214-
215167 public function modifySubmissionSteps ($ hookName , $ params )
216168 {
217169 $ request = Application::get ()->getRequest ();
0 commit comments