The following notices are thrown when changing the "Extraction method" select component:
Notice: Undefined index: python_pdf2txt_script in Drupal\search_api_attachments\Plugin\search_api_attachments\PythonPdf2txtExtractor->validateConfigurationForm() (line 82 of modules/contrib/search_api_attachments/src/Plugin/search_api_attachments/PythonPdf2txtExtractor.php)
Notice: Undefined index: python_path in Drupal\search_api_attachments\Plugin\search_api_attachments\PythonPdf2txtExtractor->validateConfigurationForm() (line 81 of modules/contrib/search_api_attachments/src/Plugin/search_api_attachments/PythonPdf2txtExtractor.php)
This is caused by the fact that the validateConfigurationForm() method from the extractor plugin we just selected is run but I believe shouldn't since the form state still contains the old text_extractor_config values.
I suggest to add a #value form element in $form['text_extractor_config'] which will hold the extractor plugin ID it belongs to so we can decide to validate the form or not in \Drupal\search_api_attachments\Form\TextExtractorFormSettings::validateForm().
This will also allow us to remove the various isset($form['text_extractor_config']..) and normalize a bit the code.
Comments
Comment #2
herved commentedComment #3
izus commentedhi,
your suggestion makes sens
Thanks for this :)
Comment #5
izus commentedThis is now merged
Thanks again ;)