Skip to content

Instantly share code, notes, and snippets.

@asika32764
Created July 23, 2015 03:31
Show Gist options
  • Select an option

  • Save asika32764/66134b3adfc8bb46174d to your computer and use it in GitHub Desktop.

Select an option

Save asika32764/66134b3adfc8bb46174d to your computer and use it in GitHub Desktop.
<?php
/**
* Part of Ezset project.
*
* @copyright Copyright (C) 2015 {ORGANIZATION}. All rights reserved.
* @license GNU General Public License version 2 or later;
*/
namespace MyEzset\Listener\ModuleRedirect;
/**
* The ModuleRedirectListener class.
*
* @since {DEPLOY_VERSION}
*/
class ModuleRedirectListener extends \JEvent
{
/**
* After Route Event.
*/
public function onAfterRoute()
{
$app = \JFactory::getApplication();
$input = $app->input;
$option = $input->get('option');
$view = $input->get('view');
$task = $input->get('task');
if ($option == 'com_modules')
{
if ($task == 'module.save')
{
$redirect = \JUri::base();
$app->setUserState('mod_modules.save.return', $redirect);
}
if ($view == 'modules')
{
$redirect = $app->getUserState('mod_modules.save.return');
if ($redirect)
{
$app->setUserState('mod_modules.save.return', null);
$app->redirect($redirect);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment