Commit 2cc36233 authored by Uragawa's avatar Uragawa
Browse files

adiciona AldirBlancRedirects como submodule

parent f598bdf9
Pipeline #9823 passed with stages
in 45 seconds
......@@ -4,3 +4,6 @@
[submodule "plugins/MultipleLocalAuth"]
path = plugins/MultipleLocalAuth
url = https://github.com/mapasculturais/plugin-MultipleLocalAuth
[submodule "plugins/AldirBlancRedirects"]
path = plugins/AldirBlancRedirects
url = https://github.com/mapasculturais/plugin-AldirBlancRedirects
Subproject commit 5dfe5f8bcf0755ddad01c2afe4d7b5e0ca9a6afa
<?php
namespace AldirBlancRedirects;
use MapasCulturais\App;
class Plugin extends \MapasCulturais\Plugin {
public function _init() {
// enqueue scripts and styles
// add hooks
}
public function register() {
$app = App::i();
$app->_config['routes']['default_controller_id'] = 'aldirblanc';
$config = $this->config;
$app->hook('GET(<<*>>):before', function() use($app, $config) {
$enabled_routes = [
['site', 'address_by_postalcode']
];
if (in_array([$this->id, $this->action], $enabled_routes)) {
return;
}
if(!in_array($this->id, ['aldirblanc', 'auth'])){
if(!$config['condition']()){
$app->redirect($app->createUrl('aldirblanc', 'index'));
}
}
});
if ( !isset($_SESSION['mapasculturais.auth.redirect_path']) ){
$_SESSION['mapasculturais.auth.redirect_path'] = $app->createUrl('aldirblanc', 'cadastro');
}
$app->hook('controller(auth).render(<<*>>)', function() {
$this->layout = 'aldirblanc';
}, -1);
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment