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

herved created an issue. See original summary.

herved’s picture

Status: Active » Needs review
StatusFileSize
new10.39 KB
izus’s picture

hi,
your suggestion makes sens
Thanks for this :)

  • izus committed 39155c9 on 8.x-1.x authored by herved
    Issue #3034052 by herved, izus: PHP notices when changing extraction...
izus’s picture

Status: Needs review » Fixed

This is now merged
Thanks again ;)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.