Skip to content

Commit

Permalink
Add hook 'media not found'
Browse files Browse the repository at this point in the history
  • Loading branch information
David Vandemaele committed Nov 26, 2015
1 parent f9bef87 commit fabfca8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/Skeleton/Core/Hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*
* @author Gerry Demaret <[email protected]>
* @author Christophe Gosiau <[email protected]>
* @author David Vandemaele <[email protected]>
*/

namespace Skeleton\Core;
Expand All @@ -18,6 +19,7 @@ class Hook {
'handle_error',
'module_access_denied',
'module_not_found',
'media_not_found',
];

/**
Expand Down
8 changes: 6 additions & 2 deletions lib/Skeleton/Core/Web/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Media {
],
'font' => [
'woff',
'woff2',
'woff2',
'ttf',
'otf',
'eot'
Expand Down Expand Up @@ -147,7 +147,11 @@ public static function detect($request_uri) {
* @access private
*/
private static function fail() {
HTTP\Status::code_404('media');
if (\Skeleton\Core\Hook::exists('media_not_found')) {
\Skeleton\Core\Hook::call('media_not_found');
} else {
HTTP\Status::code_404('media');
}
}

/**
Expand Down

0 comments on commit fabfca8

Please sign in to comment.