Skip to content

Commit d4c3a5e

Browse files
committed
Breaking: Remove the mediaLink helper replaced by the Asset API
1 parent f9ec8dc commit d4c3a5e

File tree

6 files changed

+2
-46
lines changed

6 files changed

+2
-46
lines changed

docs/_data/partials/hyde-pages-api/hyde-kernel-hyperlink-methods.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<section id="hyde-kernel-hyperlink-methods">
22

33
<!-- Start generated docs for Hyde\Foundation\Concerns\ForwardsHyperlinks -->
4-
<!-- Generated by HydePHP DocGen script at 2024-09-02 11:18:08 in 0.14ms -->
4+
<!-- Generated by HydePHP DocGen script at 2024-09-04 19:44:45 in 0.10ms -->
55

66
#### `formatLink()`
77

@@ -19,14 +19,6 @@ No description provided.
1919
Hyde::relativeLink(string $destination): string
2020
```
2121

22-
#### `mediaLink()`
23-
24-
No description provided.
25-
26-
```php
27-
Hyde::mediaLink(string $destination, bool $validate): string
28-
```
29-
3022
#### `asset()`
3123

3224
No description provided.

docs/architecture-concepts/the-hydekernel.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,6 @@ No description provided.
205205
Hyde::relativeLink(string $destination): string
206206
```
207207

208-
#### `mediaLink()`
209-
210-
No description provided.
211-
212-
```php
213-
Hyde::mediaLink(string $destination, bool $validate): string
214-
```
215-
216208
#### `asset()`
217209

218210
No description provided.

ide.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
"condition": [
2424
{
25-
"methodNames": ["get", "mediaLink", "hasMediaFile"],
25+
"methodNames": ["get", "hasMediaFile"],
2626
"place": "parameter",
2727
"classFqn": ["\\Hyde\\Facades\\Asset"],
2828
"parameters": [1]

packages/framework/src/Facades/Asset.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ public static function get(string $file): MediaFile
2222
return hyde()->asset($file);
2323
}
2424

25-
public static function mediaLink(string $file): string
26-
{
27-
return hyde()->mediaLink($file);
28-
}
29-
3025
public static function hasMediaFile(string $file): bool
3126
{
3227
return file_exists(MediaFile::sourcePath($file));

packages/framework/src/Foundation/Concerns/ForwardsHyperlinks.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ public function relativeLink(string $destination): string
2424
return $this->hyperlinks->relativeLink($destination);
2525
}
2626

27-
public function mediaLink(string $destination, bool $validate = false): string
28-
{
29-
return $this->hyperlinks->mediaLink($destination, $validate);
30-
}
31-
3227
public function asset(string $name): MediaFile
3328
{
3429
return $this->hyperlinks->asset($name);

packages/framework/src/Foundation/Kernel/Hyperlinks.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use function str_ends_with;
1515
use function str_starts_with;
1616
use function substr_count;
17-
use function file_exists;
1817
use function str_replace;
1918
use function str_repeat;
2019
use function substr;
@@ -87,23 +86,6 @@ public function relativeLink(string $destination): string
8786
return str_replace('//', '/', $route);
8887
}
8988

90-
/**
91-
* Gets a relative web link to the given file stored in the _site/media folder.
92-
*
93-
* @deprecated Use the `asset` method instead.
94-
*
95-
* An exception will be thrown if the file does not exist in the _media directory,
96-
* and the second argument is set to true.
97-
*/
98-
public function mediaLink(string $destination, bool $validate = false): string
99-
{
100-
if ($validate && ! file_exists($sourcePath = "{$this->kernel->getMediaDirectory()}/$destination")) {
101-
throw new FileNotFoundException($sourcePath);
102-
}
103-
104-
return static::withCacheBusting($this->relativeLink("{$this->kernel->getMediaOutputDirectory()}/$destination"), $destination);
105-
}
106-
10789
/**
10890
* Gets a MediaAsset instance for the given file stored in the `_site/media` folder.
10991
* The returned value can be cast into a string in Blade views to resole the URL.

0 commit comments

Comments
 (0)