diff --git a/spamspan.module b/spamspan.module index f02af84097374ea8d62c0e238f777735d3ac44a8..fc5b234874e945ea7dbbc693391ffa3720aa9182 100644 --- a/spamspan.module +++ b/spamspan.module @@ -63,7 +63,7 @@ function spamspan_theme($existing, $type, $theme, $path) { return [ 'spamspan_at_sign' => [ 'variables' => [ - 'path' => base_path() . drupal_get_path('module', 'spamspan') . '/image.gif', + 'path' => base_path() . \Drupal::service('extension.list.module')->getPath('spamspan') . '/image.gif', 'settings' => [], ], ], diff --git a/tests/src/Kernel/FilterSpamspanUnitTest.php b/tests/src/Kernel/FilterSpamspanUnitTest.php index d9ccb90530b49fd7d6f41fc2a23cc2f60c5ba5f8..914c2dff4d472f5f84d9cf7d4cdc98537fde64b1 100644 --- a/tests/src/Kernel/FilterSpamspanUnitTest.php +++ b/tests/src/Kernel/FilterSpamspanUnitTest.php @@ -83,7 +83,7 @@ class FilterSpamspanUnitTest extends KernelTestBase { $this->spamspanFilterAtDot = $manager->createInstance('filter_spamspan', $configuration); // Read the test image from the file provided. - $this->base64Image = file_get_contents(drupal_get_path('module', 'spamspan') . '/tests/src/Kernel/base64image.txt'); + $this->base64Image = file_get_contents(\Drupal::service('extension.list.module')->getPath('spamspan') . '/tests/src/Kernel/base64image.txt'); } @@ -247,10 +247,8 @@ class FilterSpamspanUnitTest extends KernelTestBase { // Graphical at and [dot]. $emails = [ 'user@example.com' => $this->withDom - ? '<span class="spamspan"><span class="u">user</span><img class="spamspan-image" alt="at" src="' . base_path() . drupal_get_path('module', - 'spamspan') . '/image.gif"><span class="d">example<span class="o"> [dot] </span>com</span></span>' - : '<span class="spamspan"><span class="u">user</span><img class="spamspan-image" alt="at" src="' . base_path() . drupal_get_path('module', - 'spamspan') . '/image.gif" /><span class="d">example<span class="o"> [dot] </span>com</span></span>', + ? '<span class="spamspan"><span class="u">user</span><img class="spamspan-image" alt="at" src="' . base_path() . \Drupal::service('extension.list.module')->getPath('spamspan') . '/image.gif"><span class="d">example<span class="o"> [dot] </span>com</span></span>' + : '<span class="spamspan"><span class="u">user</span><img class="spamspan-image" alt="at" src="' . base_path() . \Drupal::service('extension.list.module')->getPath('spamspan') . '/image.gif" /><span class="d">example<span class="o"> [dot] </span>com</span></span>', ]; foreach ($emails as $input => $shouldbe) {