Skip to content

Kirby 6.0.0

JavaScript URLs

Used by the js() helper

/site/plugins/js-helper/index.php
Kirby::plugin(
  name: 'my/js',
  extends: [
    'components' => [
      'js' => function (Kirby $kirby, string $url, $options = null): string {
        // create fingerprint for cache busting
        $fingerprint = md5_file($url);
        return $url . '?' . $fingerprint;
      }
    ]
  ]
);

Parameters

Name Type Default Description
$kirbyrequired Kirby\Cms\App no default value
$urlrequired string no default value Relative or absolute URL
$options stringorarray null An array of attributes for the link tag or a media attribute string

Return type

string