Permalink
Browse files

Breadcrumbs url route

  • Loading branch information...
JustCarmen committed Dec 10, 2017
1 parent 99eac91 commit 55fadb52f0d714135f08bd8b158fad5fce0b32d6
Showing with 33 additions and 32 deletions.
  1. +4 −3 app/Template/AdminTemplate.php
  2. +29 −29 module.php
@@ -148,9 +148,10 @@ function (index, element) {
private function pageBody(PageController $controller) {
echo Bootstrap4::breadcrumbs([
'admin.php' => I18N::translate('Control panel'),
'admin_modules.php' => I18N::translate('Module administration'),
], $controller->getPageTitle()); ?>
route('admin-control-panel') => I18N::translate('Control panel'),
route('admin-modules') => I18N::translate('Module administration'),
'module.php?mod=' . $this->getName() . '&mod_action=admin_config' => $this->getTitle(),
], $controller->getPageTitle()); ?>
<h1><?= $controller->getPageTitle() ?></h1>
<form action="<?= $this->getConfigLink() ?>" enctype="multipart/form-data" name="configform" method="post" class="form-horizontal">
@@ -14,19 +14,19 @@
* 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\Html;
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\Html;
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
@@ -37,44 +37,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();
@@ -86,16 +86,16 @@ public function modAction($mod_action) {
default:
http_response_code(404);
break;
}
}
}
/** {@inheritdoc} */
public function getConfigLink() {
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 55fadb5

Please sign in to comment.