Permalink
Browse files

New url root

  • Loading branch information...
JustCarmen committed Dec 10, 2017
1 parent 59b8985 commit 539669c4ae33e4f93d5b50bd161b43b24c4eb283
Showing with 32 additions and 29 deletions.
  1. +32 −29 module.php
@@ -14,18 +14,18 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace JustCarmen\WebtreesAddOns\JustLight;
use Composer\Autoload\ClassLoader;
use Fisharebest\Webtrees\Database;
use Fisharebest\Webtrees\Filter;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Log;
use Fisharebest\Webtrees\Module\AbstractModule;
use Fisharebest\Webtrees\Module\ModuleConfigInterface;
use JustCarmen\WebtreesAddOns\JustLight\Template\AdminTemplate;
class JustLightThemeOptionsModule extends AbstractModule implements ModuleConfigInterface {
namespace JustCarmen\WebtreesAddOns\JustLight;
use Composer\Autoload\ClassLoader;
use Fisharebest\Webtrees\Database;
use Fisharebest\Webtrees\Filter;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Log;
use Fisharebest\Webtrees\Module\AbstractModule;
use Fisharebest\Webtrees\Module\ModuleConfigInterface;
use JustCarmen\WebtreesAddOns\JustLight\Template\AdminTemplate;
class JustLightThemeOptionsModule extends AbstractModule implements ModuleConfigInterface {
const CUSTOM_VERSION = '2.0.0-dev';
const CUSTOM_WEBSITE = 'http://www.justcarmen.nl/themes/justlight/';
// How to update the database schema for this module
@@ -36,44 +36,44 @@ class JustLightThemeOptionsModule extends AbstractModule implements ModuleConfig
/** @var string location of the JustBlack Theme Options module files */
public $directory;
public function __construct() {
public function __construct() {
parent::__construct('justlight_theme_options');
$this->directory = WT_MODULES_DIR . $this->getName();
// register the namespace
$loader = new ClassLoader();
$loader->addPsr4('JustCarmen\\WebtreesAddOns\\JustLight\\', $this->directory . '/app');
$loader->register();
$loader->register();
}
/**
* Get the module class.
*
* Class functions are called with $this inside the source directory.
*/
private function module() {
return new JustLightThemeOptionsClass;
private function module() {
return new JustLightThemeOptionsClass;
}
// Extend Module
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('JustLight Theme Options');
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('JustLight Theme Options');
}
// Extend Module
public function getDescription() {
return /* I18N: Description of the module */ I18N::translate('Set options for the JustLight theme within the admin interface');
public function getDescription() {
return /* I18N: Description of the module */ I18N::translate('Set options for the JustLight theme within the admin interface');
}
// Extend ModuleConfigInterface
public function modAction($mod_action) {
public function modAction($mod_action) {
Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
switch ($mod_action) {
case 'admin_config':
if (Filter::postBool('save') && Filter::checkCsrf()) {
$this->module()->saveOptions();
if (Filter::postBool('save') && Filter::checkCsrf()) {
$this->module()->saveOptions();
}
$template = new AdminTemplate;
return $template->pageContent();
@@ -85,13 +85,16 @@ public function modAction($mod_action) {
default:
http_response_code(404);
break;
}
}
}
// Implement ModuleConfigInterface
public function getConfigLink() {
return 'module.php?mod=' . $this->getName() . '&amp;mod_action=admin_config';
}
/** {@inheritdoc} */
public function getConfigLink() {
return Html::url('module.php', [
'mod' => $this->getName(),
'mod_action' => 'admin_config',
]);
}
}
return new JustLightThemeOptionsModule;
return new JustLightThemeOptionsModule;

0 comments on commit 539669c

Please sign in to comment.