Problem/Motivation
While using UI (/admin/config/regional/translate/extract) extract page. It comes by this deprecation message:
Deprecated function: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in Drupal\potx\Form\PotxExtractTranslationForm->getFormElementId() (line 353 of modules/contrib/potx/src/Form/PotxExtractTranslationForm.php).
Drupal\potx\Form\PotxExtractTranslationForm->getFormElementId('com', NULL) (Line: 321)
Drupal\potx\Form\PotxExtractTranslationForm->buildComponentSelector(Array, Array, '/profiles/SOME_PROFILE_HERE') (Line: 333)
Drupal\potx\Form\PotxExtractTranslationForm->buildComponentSelector(Array, Array, '/profiles') (Line: 333)
Drupal\potx\Form\PotxExtractTranslationForm->buildComponentSelector(Array, Array) (Line: 80)
Drupal\potx\Form\PotxExtractTranslationForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 534)
Drupal\Core\Form\FormBuilder->retrieveForm('potx_extract_transation', Object) (Line: 281)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 49)
Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle(Object, 1, 1) (Line: 57)
Drupal\debug_bar\DebugBarMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 713)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Steps to reproduce
Install a module without .module file and with submodules, then go to export form page /admin/config/regional/translate/extract. EG:
my_module/
- modules/
- my_module_submodule1/
- my_module_submodule1.info.yml
- my_module_submodule2/
- my_module_submodule2.info.yml
- my_module.info.yml
Proposed resolution
Build the form based on mandatory files like .info.yml.