1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-08 07:47:00 +02:00

Add $config->versionUrls() method for versioned file URLs and update the admin themes to use it

This commit is contained in:
Ryan Cramer
2023-09-08 11:58:38 -04:00
parent deccd2c8eb
commit 7dc8ddc9af
5 changed files with 117 additions and 12 deletions

View File

@@ -10,7 +10,7 @@
*
*/
class FilenameArray implements \IteratorAggregate, \Countable {
class FilenameArray extends Wire implements \IteratorAggregate, \Countable {
/**
* Array of filenames indexed by MD5 hash of filename
@@ -87,6 +87,23 @@ class FilenameArray implements \IteratorAggregate, \Countable {
return new \ArrayObject($this->data);
}
/**
* Get cache-busting URLs for this FilenameArray
*
* This is the same as iterating this FilenameArray except that it appends cache-busting
* query strings to the URLs that resolve to physical files.
*
* @param bool|null|string $useVersion See Config::versionUrls() for arument details
* @return array
* @throws WireException
* @see Config::versionUrls()
* @since 3.0.227
*
*/
public function urls($useVersion = null) {
return $this->wire()->config->versionUrls($this, $useVersion);
}
/**
* Make FilenameArray unique (deprecated)
*