Skip to content

Commit

Permalink
Added new logged_in and logged_out parser plugins.
Browse files Browse the repository at this point in the history
  • Loading branch information
lonnieezell committed Aug 14, 2018
1 parent 6b0ea47 commit 564c934
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/Config/Registrar.php
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 : ''; } ],
]
];
}
}

0 comments on commit 564c934

Please sign in to comment.