Skip to content
Snippets Groups Projects

Issue #3238915: Refactor (if feasible) uses of the jQuery ready function to use VanillaJS

Closed Issue #3238915: Refactor (if feasible) uses of the jQuery ready function to use VanillaJS
Closed Harumi Jang requested to merge issue/drupal-3238915:3238915-refactor-if-feasible into 9.3.x
2 files
+ 18
1
Compare changes
  • Side-by-side
  • Inline
Files
2
  • 8d1c4c16
    Issue #3254245 by kim.pepper, Jeya sundhar, mrweiner, bakulahluwalia, Berdir,... · 8d1c4c16
    catch authored
    Issue #3254245 by kim.pepper, Jeya sundhar, mrweiner, bakulahluwalia, Berdir, catch, newaytech, Summit: TypeError: Argument 1 passed to Drupal\Core\File\FileUrlGenerator::generateString() must be of the type string, null given
@@ -107,7 +107,7 @@ public function getFunctions() {
new TwigFunction('url', [$this, 'getUrl'], ['is_safe_callback' => [$this, 'isUrlGenerationSafe']]),
new TwigFunction('path', [$this, 'getPath'], ['is_safe_callback' => [$this, 'isUrlGenerationSafe']]),
new TwigFunction('link', [$this, 'getLink']),
new TwigFunction('file_url', [$this->fileUrlGenerator, 'generateString']),
new TwigFunction('file_url', [$this, 'getFileUrl']),
new TwigFunction('attach_library', [$this, 'attachLibrary']),
new TwigFunction('active_theme_path', [$this, 'getActiveThemePath']),
new TwigFunction('active_theme', [$this, 'getActiveTheme']),
@@ -272,6 +272,22 @@ public function getLink($text, $url, $attributes = []) {
return $build;
}
/**
* Gets the file URL.
*
* @param string|null $uri
* The file URI.
*
* @return string
* The file URL.
*/
public function getFileUrl(?string $uri) {
if (is_null($uri)) {
return NULL;
}
return $this->fileUrlGenerator->generateString($uri);
}
/**
* Gets the name of the active theme.
*
Loading