-
-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new logged_in and logged_out parser plugins.
- Loading branch information
1 parent
6b0ea47
commit 564c934
Showing
1 changed file
with
29 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php namespace Myth\Auth\Config; | ||
|
||
use Config\Services; | ||
|
||
/** | ||
* Helper class that will register our bulk plugins | ||
* and filters with the View Parser class. | ||
* | ||
* Called automatically by Config\View as long as | ||
* this file is setup as a Registrar: | ||
* | ||
* protected $registrars = [ | ||
* \Myth\Template\Registrar::class | ||
* ]; | ||
* | ||
* @package Myth\Template | ||
*/ | ||
class Registrar | ||
{ | ||
public static function View() | ||
{ | ||
return [ | ||
'plugins' => [ | ||
'logged_in' => [ function($str, array $params=[]) { return Services::authentication()->check() ? $str : ''; } ], | ||
'logged_out' => [ function($str, array $params=[]) { return ! Services::authentication()->check() ? $str : ''; } ], | ||
] | ||
]; | ||
} | ||
} |