@@ -35,7 +35,6 @@ public function __construct(
3535 ConfigFactoryInterface $ config_factory ,
3636 EntityTypeManagerInterface $ entityTypeManager ,
3737 private readonly Settings $ settings ,
38- private readonly CertificateLocatorHelper $ certificateLocatorHelper ,
3938 ) {
4039 parent ::__construct ($ config_factory );
4140 $ this ->queueStorage = $ entityTypeManager ->getStorage ('advancedqueue_queue ' );
@@ -51,7 +50,6 @@ public static function create(ContainerInterface $container) {
5150 $ container ->get ('config.factory ' ),
5251 $ container ->get ('entity_type.manager ' ),
5352 $ container ->get (Settings::class),
54- $ container ->get (CertificateLocatorHelper::class),
5553 );
5654 }
5755
@@ -289,15 +287,6 @@ public function buildForm(array $form, FormStateInterface $form_state): array {
289287 ),
290288 ];
291289
292- $ form ['actions ' ]['testCertificate ' ] = [
293- '#type ' => 'submit ' ,
294- '#name ' => 'testCertificate ' ,
295- '#value ' => $ this ->t ('Test certificate ' ),
296- '#states ' => [
297- 'visible ' => [':input[name="certificate[certificate_provider]"] ' => ['value ' => Settings::PROVIDER_TYPE_FORM ]],
298- ],
299- ];
300-
301290 return $ form ;
302291 }
303292
@@ -307,11 +296,6 @@ public function buildForm(array $form, FormStateInterface $form_state): array {
307296 * @phpstan-param array<string, mixed> $form
308297 */
309298 public function validateForm (array &$ form , FormStateInterface $ form_state ): void {
310- $ triggeringElement = $ form_state ->getTriggeringElement ();
311- if ('testCertificate ' === ($ triggeringElement ['#name ' ] ?? NULL )) {
312- return ;
313- }
314-
315299 $ values = $ form_state ->getValues ();
316300
317301 if (Settings::PROVIDER_TYPE_FORM === $ values [Settings::CERTIFICATE ][Settings::CERTIFICATE_PROVIDER ]) {
@@ -332,12 +316,6 @@ public function validateForm(array &$form, FormStateInterface $form_state): void
332316 * @phpstan-param array<string, mixed> $form
333317 */
334318 public function submitForm (array &$ form , FormStateInterface $ form_state ): void {
335- $ triggeringElement = $ form_state ->getTriggeringElement ();
336- if ('testCertificate ' === ($ triggeringElement ['#name ' ] ?? NULL )) {
337- $ this ->testCertificate ();
338- return ;
339- }
340-
341319 $ config = $ this ->config (Settings::CONFIG_NAME );
342320 foreach ([
343321 Settings::TEST_MODE ,
@@ -376,20 +354,4 @@ private function createDescription(string|array $key, ?TranslatableMarkup $descr
376354 return (string ) $ description ;
377355 }
378356
379- /**
380- * Test certificate.
381- */
382- private function testCertificate (): void {
383- try {
384-
385- $ certificateLocator = $ this ->certificateLocatorHelper ->getCertificateLocator ();
386- $ certificateLocator ->getCertificates ();
387- $ this ->messenger ()->addStatus ($ this ->t ('Certificate succesfully tested ' ));
388- }
389- catch (\Throwable $ throwable ) {
390- $ message = $ this ->t ('Error testing certificate: %message ' , ['%message ' => $ throwable ->getMessage ()]);
391- $ this ->messenger ()->addError ($ message );
392- }
393- }
394-
395357}
0 commit comments