-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
44 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
|
||
namespace Webbinaro\AdvCalendar\Integrations; | ||
|
||
use Flarum\Extend\ExtenderInterface; | ||
use Flarum\Extension\Extension; | ||
use FoF\Sitemap\Resources\Resource; | ||
use Illuminate\Contracts\Container\Container; | ||
use InvalidArgumentException; | ||
|
||
/** | ||
* Class EventResourceRegister | ||
* @package Webbinaro\AdvCalendar\Integrations | ||
* Purely a copy and workaround of the reigster function form fof/sitemaps | ||
* until https://github.com/FriendsOfFlarum/sitemap/pull/15 is fixed | ||
*/ | ||
class EventResourceRegister implements ExtenderInterface | ||
{ | ||
|
||
public function extend(Container $container, Extension $extension = null) | ||
{ | ||
$container->extend('fof.sitemap.resources', function (array $resources) use ($container) { | ||
$resource = $container->make(EventResource::class); | ||
|
||
if ($resource instanceof Resource) { | ||
$resources[] = $resource; | ||
} else { | ||
throw new InvalidArgumentException("{EventResource::class} has to extend ".Resource::class); | ||
} | ||
|
||
return $resources; | ||
}); | ||
} | ||
} |