Skip to content

Commit 4a3d109

Browse files
committed
FontAsset: added crossorigin property
1 parent 99b77ce commit 4a3d109

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/Assets/FontAsset.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public function __construct(
1919
?string $mimeType = null,
2020
/** SRI integrity hash */
2121
public readonly ?string $integrity = null,
22+
public readonly string|bool|null $crossorigin = null,
2223
) {
2324
$this->mimeType = $mimeType ?? Helpers::guessMimeTypeFromExtension($file ?? $url);
2425
}
@@ -37,7 +38,7 @@ public function getImportElement(): Html
3738
'href' => $this->url,
3839
'as' => 'font',
3940
'type' => $this->mimeType,
40-
'crossorigin' => true,
41+
'crossorigin' => $this->crossorigin ?? true,
4142
'integrity' => $this->integrity,
4243
], fn($value) => $value !== null));
4344
}

tests/types/assets-types.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ function testFontAssetProperties(FontAsset $asset): void
143143
assertType('string|null', $asset->file);
144144
assertType('string|null', $asset->mimeType);
145145
assertType('string|null', $asset->integrity);
146+
assertType('bool|string|null', $asset->crossorigin);
146147
}
147148

148149

0 commit comments

Comments
 (0)