mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-12 03:41:54 +00:00
Added the possibility of social provider extension via theme
Also started docs page
This commit is contained in:
parent
9d37af9453
commit
2ae89f2c32
6 changed files with 95 additions and 17 deletions
dev/docs
22
dev/docs/logic-theme-service.md
Normal file
22
dev/docs/logic-theme-service.md
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Logic Theme Service
|
||||
|
||||
|
||||
#### Custom Socialite Service Example
|
||||
|
||||
The below shows an example of adding a custom reddit socialite service to BookStack.
|
||||
BookStack exposes a helper function for this via `Theme::addSocialDriver` which sets the required config and event listeners in the platform.
|
||||
|
||||
The require statements reference composer installed dependencies within the theme folder. They are required manually since they are not auto-loaded like other app files due to being outside the main BookStack dependency list.
|
||||
|
||||
```php
|
||||
require "vendor/socialiteproviders/reddit/Provider.php";
|
||||
require "vendor/socialiteproviders/reddit/RedditExtendSocialite.php";
|
||||
|
||||
Theme::listen(ThemeEvents::APP_BOOT, function($app) {
|
||||
Theme::addSocialDriver('reddit', [
|
||||
'client_id' => 'abc123',
|
||||
'client_secret' => 'def456789',
|
||||
'name' => 'Reddit',
|
||||
], '\SocialiteProviders\Reddit\RedditExtendSocialite@handle');
|
||||
});
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue