diff --git a/composer.lock b/composer.lock
index d9119399ac..ae7d908671 100644
--- a/composer.lock
+++ b/composer.lock
@@ -718,8 +718,8 @@
"type": "library",
"extra": {
"thanks": {
- "name": "symfony/polyfill",
- "url": "https://github.com/symfony/polyfill"
+ "url": "https://github.com/symfony/polyfill",
+ "name": "symfony/polyfill"
}
},
"autoload": {
@@ -877,8 +877,8 @@
"type": "library",
"extra": {
"thanks": {
- "name": "symfony/polyfill",
- "url": "https://github.com/symfony/polyfill"
+ "url": "https://github.com/symfony/polyfill",
+ "name": "symfony/polyfill"
}
},
"autoload": {
diff --git a/config/components.php b/config/components.php
index 7180fc9846..c149ba135e 100644
--- a/config/components.php
+++ b/config/components.php
@@ -230,7 +230,7 @@
$scoring['score'] += 16 * $score;
$scoring['hits'] += 1;
- // check for exact beginning matches
+ // check for exact beginning matches
} elseif (
$options['words'] === false &&
Str::startsWith($lowerValue, $query) === true
@@ -238,7 +238,7 @@
$scoring['score'] += 8 * $score;
$scoring['hits'] += 1;
- // check for exact query matches
+ // check for exact query matches
} elseif ($matches = preg_match_all('!' . $exact . '!ui', $value, $r)) {
$scoring['score'] += 2 * $score;
$scoring['hits'] += $matches;
diff --git a/src/Cms/Files.php b/src/Cms/Files.php
index f935bf9303..d75b1f26dd 100644
--- a/src/Cms/Files.php
+++ b/src/Cms/Files.php
@@ -51,19 +51,19 @@ public function add($object): static
if ($object instanceof self) {
$this->data = [...$this->data, ...$object->data];
- // add a file by id
+ // add a file by id
} elseif (
is_string($object) === true &&
$file = App::instance()->file($object)
) {
$this->__set($file->id(), $file);
- // add a file object
+ // add a file object
} elseif ($object instanceof File) {
$this->__set($object->id(), $object);
- // give a useful error message on invalid input;
- // silently ignore "empty" values for compatibility with existing setups
+ // give a useful error message on invalid input;
+ // silently ignore "empty" values for compatibility with existing setups
} elseif (in_array($object, [null, false, true], true) !== true) {
throw new InvalidArgumentException(
message: 'You must pass a Files or File object or an ID of an existing file to the Files collection'
diff --git a/src/Cms/PagePicker.php b/src/Cms/PagePicker.php
index 7c4dda8fac..c0d40de3ab 100644
--- a/src/Cms/PagePicker.php
+++ b/src/Cms/PagePicker.php
@@ -127,13 +127,13 @@ public function items(): Pages|null
if (empty($this->options['query']) === true) {
$items = $this->itemsForParent();
- // when subpage navigation is enabled, a parent
- // might be passed in addition to the query.
- // The parent then takes priority.
+ // when subpage navigation is enabled, a parent
+ // might be passed in addition to the query.
+ // The parent then takes priority.
} elseif ($this->options['subpages'] === true && empty($this->options['parent']) === false) {
$items = $this->itemsForParent();
- // search by query
+ // search by query
} else {
$items = $this->itemsForQuery();
}
diff --git a/src/Cms/Pages.php b/src/Cms/Pages.php
index 4443e431ac..e24871854e 100644
--- a/src/Cms/Pages.php
+++ b/src/Cms/Pages.php
@@ -64,19 +64,19 @@ public function add($object): static
if ($object instanceof self) {
$this->data = [...$this->data, ...$object->data];
- // add a page by id
+ // add a page by id
} elseif (
is_string($object) === true &&
$page = $site->find($object)
) {
$this->__set($page->id(), $page);
- // add a page object
+ // add a page object
} elseif ($object instanceof Page) {
$this->__set($object->id(), $object);
- // give a useful error message on invalid input;
- // silently ignore "empty" values for compatibility with existing setups
+ // give a useful error message on invalid input;
+ // silently ignore "empty" values for compatibility with existing setups
} elseif (in_array($object, [null, false, true], true) !== true) {
throw new InvalidArgumentException(
message: 'You must pass a Pages or Page object or an ID of an existing page to the Pages collection'
diff --git a/src/Cms/Users.php b/src/Cms/Users.php
index c67d1fe11f..08d9e93dd2 100644
--- a/src/Cms/Users.php
+++ b/src/Cms/Users.php
@@ -51,19 +51,19 @@ public function add($object): static
if ($object instanceof self) {
$this->data = [...$this->data, ...$object->data];
- // add a user by id
+ // add a user by id
} elseif (
is_string($object) === true &&
$user = App::instance()->user($object)
) {
$this->__set($user->id(), $user);
- // add a user object
+ // add a user object
} elseif ($object instanceof User) {
$this->__set($object->id(), $object);
- // give a useful error message on invalid input;
- // silently ignore "empty" values for compatibility with existing setups
+ // give a useful error message on invalid input;
+ // silently ignore "empty" values for compatibility with existing setups
} elseif (in_array($object, [null, false, true], true) !== true) {
throw new InvalidArgumentException(
message: 'You must pass a Users or User object or an ID of an existing user to the Users collection'
diff --git a/src/Http/Environment.php b/src/Http/Environment.php
index 2339cb5aca..6509ffd71b 100644
--- a/src/Http/Environment.php
+++ b/src/Http/Environment.php
@@ -178,11 +178,11 @@ public function detect(
if ($options['allowed'] === '*' || $options['allowed'] === ['*']) {
$this->detectAuto(true);
- // fixed environments
+ // fixed environments
} elseif (empty($options['allowed']) === false) {
$this->detectAllowed($options['allowed']);
- // secure auto-detection
+ // secure auto-detection
} else {
$this->detectAuto();
}
diff --git a/src/Image/Image.php b/src/Image/Image.php
index 66e6081508..6a24082b22 100644
--- a/src/Image/Image.php
+++ b/src/Image/Image.php
@@ -2,6 +2,7 @@
namespace Kirby\Image;
+use Kirby\Cms\FileVersion;
use Kirby\Content\Content;
use Kirby\Exception\LogicException;
use Kirby\Filesystem\File;
@@ -115,15 +116,20 @@ public function height(): int
*/
public function html(array $attr = []): string
{
+ $model = match (true) {
+ $this->model instanceof FileVersion => $this->model->original(),
+ default => $this->model
+ };
+
// if no alt text explicitly provided,
// try to infer from model content file
if (
- $this->model !== null &&
- method_exists($this->model, 'content') === true &&
- $this->model->content() instanceof Content &&
- $this->model->content()->get('alt')->isNotEmpty() === true
+ $model !== null &&
+ method_exists($model, 'content') === true &&
+ $model->content() instanceof Content &&
+ $model->content()->get('alt')->isNotEmpty() === true
) {
- $attr['alt'] ??= $this->model->content()->get('alt')->value();
+ $attr['alt'] ??= $model->content()->get('alt')->value();
}
if ($url = $this->url()) {
diff --git a/src/Panel/Panel.php b/src/Panel/Panel.php
index 40c10b86d2..de979365c7 100644
--- a/src/Panel/Panel.php
+++ b/src/Panel/Panel.php
@@ -274,7 +274,7 @@ public static function response($result, array $options = []): Response
message: 'The data could not be found'
);
- // interpret strings as errors
+ // interpret strings as errors
} elseif (is_string($result) === true) {
$result = new Exception($result);
}
diff --git a/src/Parsley/Parsley.php b/src/Parsley/Parsley.php
index 1ddb7d4604..a819ac41f9 100644
--- a/src/Parsley/Parsley.php
+++ b/src/Parsley/Parsley.php
@@ -214,7 +214,7 @@ public function mergeOrAppend(array $block): void
) {
$this->blocks[$lastIndex]['content']['text'] .= ' ' . $block['content']['text'];
- // append
+ // append
} else {
$this->blocks[] = $block;
}
diff --git a/src/Toolkit/A.php b/src/Toolkit/A.php
index b69c071d87..be9053e84f 100644
--- a/src/Toolkit/A.php
+++ b/src/Toolkit/A.php
@@ -510,7 +510,7 @@ public static function merge(array|int ...$arrays): array
) {
$merged[] = $value;
- // recursively merge the two array values
+ // recursively merge the two array values
} elseif (
is_array($value) === true &&
isset($merged[$key]) === true &&
@@ -518,7 +518,7 @@ public static function merge(array|int ...$arrays): array
) {
$merged[$key] = static::merge($merged[$key], $value, $mode);
- // simply overwrite with the value from the second array
+ // simply overwrite with the value from the second array
} else {
$merged[$key] = $value;
}
diff --git a/tests/Cms/Files/FileVersionTest.php b/tests/Cms/Files/FileVersionTest.php
index 45e15c31cb..14a41ec664 100644
--- a/tests/Cms/Files/FileVersionTest.php
+++ b/tests/Cms/Files/FileVersionTest.php
@@ -105,7 +105,11 @@ public function testToString()
'slug' => 'test'
]);
- $original = new File(['filename' => 'test.jpg', 'parent' => $page]);
+ $original = new File([
+ 'filename' => 'test.jpg',
+ 'parent' => $page,
+ 'content' => ['alt' => 'Test text']
+ ]);
$version = new FileVersion([
'original' => $original,
'root' => static::FIXTURES . '/test.txt',
@@ -120,6 +124,6 @@ public function testToString()
'url' => $url = 'https://assets.getkirby.com/test-200x200.jpg',
]);
- $this->assertSame('', (string)$version);
+ $this->assertSame('', (string)$version);
}
}
diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php
index e72b59d744..3e3705a72b 100644
--- a/vendor/composer/autoload_classmap.php
+++ b/vendor/composer/autoload_classmap.php
@@ -62,6 +62,7 @@
'Kirby\\Cms\\Blueprint' => $baseDir . '/src/Cms/Blueprint.php',
'Kirby\\Cms\\Collection' => $baseDir . '/src/Cms/Collection.php',
'Kirby\\Cms\\Collections' => $baseDir . '/src/Cms/Collections.php',
+ 'Kirby\\Cms\\ContentLocks' => $baseDir . '/src/Cms/ContentLocks.php',
'Kirby\\Cms\\Core' => $baseDir . '/src/Cms/Core.php',
'Kirby\\Cms\\Email' => $baseDir . '/src/Cms/Email.php',
'Kirby\\Cms\\Event' => $baseDir . '/src/Cms/Event.php',
@@ -101,6 +102,7 @@
'Kirby\\Cms\\LicenseType' => $baseDir . '/src/Cms/LicenseType.php',
'Kirby\\Cms\\Loader' => $baseDir . '/src/Cms/Loader.php',
'Kirby\\Cms\\Media' => $baseDir . '/src/Cms/Media.php',
+ 'Kirby\\Cms\\Model' => $baseDir . '/src/Cms/Model.php',
'Kirby\\Cms\\ModelPermissions' => $baseDir . '/src/Cms/ModelPermissions.php',
'Kirby\\Cms\\ModelWithContent' => $baseDir . '/src/Cms/ModelWithContent.php',
'Kirby\\Cms\\Nest' => $baseDir . '/src/Cms/Nest.php',
@@ -357,6 +359,7 @@
'Kirby\\Toolkit\\Locale' => $baseDir . '/src/Toolkit/Locale.php',
'Kirby\\Toolkit\\Obj' => $baseDir . '/src/Toolkit/Obj.php',
'Kirby\\Toolkit\\Pagination' => $baseDir . '/src/Toolkit/Pagination.php',
+ 'Kirby\\Toolkit\\Properties' => $baseDir . '/src/Toolkit/Properties.php',
'Kirby\\Toolkit\\Silo' => $baseDir . '/src/Toolkit/Silo.php',
'Kirby\\Toolkit\\Str' => $baseDir . '/src/Toolkit/Str.php',
'Kirby\\Toolkit\\SymmetricCrypto' => $baseDir . '/src/Toolkit/SymmetricCrypto.php',
diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php
index 11d9efeaad..b7d89a1959 100644
--- a/vendor/composer/autoload_static.php
+++ b/vendor/composer/autoload_static.php
@@ -183,6 +183,7 @@ class ComposerStaticInit0bf5c8a9cfa251a218fc581ac888fe35
'Kirby\\Cms\\Blueprint' => __DIR__ . '/../..' . '/src/Cms/Blueprint.php',
'Kirby\\Cms\\Collection' => __DIR__ . '/../..' . '/src/Cms/Collection.php',
'Kirby\\Cms\\Collections' => __DIR__ . '/../..' . '/src/Cms/Collections.php',
+ 'Kirby\\Cms\\ContentLocks' => __DIR__ . '/../..' . '/src/Cms/ContentLocks.php',
'Kirby\\Cms\\Core' => __DIR__ . '/../..' . '/src/Cms/Core.php',
'Kirby\\Cms\\Email' => __DIR__ . '/../..' . '/src/Cms/Email.php',
'Kirby\\Cms\\Event' => __DIR__ . '/../..' . '/src/Cms/Event.php',
@@ -222,6 +223,7 @@ class ComposerStaticInit0bf5c8a9cfa251a218fc581ac888fe35
'Kirby\\Cms\\LicenseType' => __DIR__ . '/../..' . '/src/Cms/LicenseType.php',
'Kirby\\Cms\\Loader' => __DIR__ . '/../..' . '/src/Cms/Loader.php',
'Kirby\\Cms\\Media' => __DIR__ . '/../..' . '/src/Cms/Media.php',
+ 'Kirby\\Cms\\Model' => __DIR__ . '/../..' . '/src/Cms/Model.php',
'Kirby\\Cms\\ModelPermissions' => __DIR__ . '/../..' . '/src/Cms/ModelPermissions.php',
'Kirby\\Cms\\ModelWithContent' => __DIR__ . '/../..' . '/src/Cms/ModelWithContent.php',
'Kirby\\Cms\\Nest' => __DIR__ . '/../..' . '/src/Cms/Nest.php',
@@ -478,6 +480,7 @@ class ComposerStaticInit0bf5c8a9cfa251a218fc581ac888fe35
'Kirby\\Toolkit\\Locale' => __DIR__ . '/../..' . '/src/Toolkit/Locale.php',
'Kirby\\Toolkit\\Obj' => __DIR__ . '/../..' . '/src/Toolkit/Obj.php',
'Kirby\\Toolkit\\Pagination' => __DIR__ . '/../..' . '/src/Toolkit/Pagination.php',
+ 'Kirby\\Toolkit\\Properties' => __DIR__ . '/../..' . '/src/Toolkit/Properties.php',
'Kirby\\Toolkit\\Silo' => __DIR__ . '/../..' . '/src/Toolkit/Silo.php',
'Kirby\\Toolkit\\Str' => __DIR__ . '/../..' . '/src/Toolkit/Str.php',
'Kirby\\Toolkit\\SymmetricCrypto' => __DIR__ . '/../..' . '/src/Toolkit/SymmetricCrypto.php',