initial commit
This commit is contained in:
commit
360ad02dc6
14
README.md
Normal file
14
README.md
Normal file
@ -0,0 +1,14 @@
|
||||
# DisableAdminElements
|
||||
Hide unused menu items in the oxid eshop admin
|
||||
|
||||
## Features
|
||||
|
||||
* you can hide any element of the xml files (e.g. menu.xml) like navigation or tab elements
|
||||
* you only need the id of the element node (e.g. 'tbclorder_downloads' or 'mxwrapping')
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
* Run this composer statement in your shop. Adjust this instruction if your installation requires it.
|
||||
|
||||
`composer require d3/disableadminelements --update-no-dev`
|
38
composer.json
Normal file
38
composer.json
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "d3/disableadminelements",
|
||||
"description": "Ausblenden von Menuepunkten im Admin",
|
||||
"type": "oxideshop-module",
|
||||
"version": "1.0",
|
||||
"keywords": [
|
||||
"oxid",
|
||||
"modules",
|
||||
"eShop",
|
||||
"d3"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "D3 Data Development (Inh. Thomas Dartsch)",
|
||||
"email": "info@shopmodule.com",
|
||||
"homepage": "http://www.d3data.de",
|
||||
"role": "Owner"
|
||||
}
|
||||
],
|
||||
"homepage": "https://www.oxidmodule.com/",
|
||||
"license": [
|
||||
"GPL-3.0-or-later"
|
||||
],
|
||||
"extra": {
|
||||
"oxideshop": {
|
||||
"source-directory": "/src",
|
||||
"target-directory": "d3/disableadminelements"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"oxid-esales/oxideshop-metapackage-ce": "~6.0.0 || ~6.1.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"D3\\DisableAdminElements\\": "../../../source/modules/d3/disableadminelements"
|
||||
}
|
||||
}
|
||||
}
|
10
src/Application/views/admin/de/disableadminelements_lang.php
Normal file
10
src/Application/views/admin/de/disableadminelements_lang.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
$sLangName = "Deutsch";
|
||||
|
||||
$aLang = array(
|
||||
'charset' => 'UTF-8',
|
||||
'SHOP_MODULE_GROUP_d3disableAdminElements_group' => 'Einstellungen',
|
||||
'SHOP_MODULE_d3disableAdminElements_elemtentlist' => 'Trage hier alle Idents (id) der auszublendenen Menüpunkte aus der menu.xml ein. z.B. "tbclorder_downloads"',
|
||||
|
||||
);
|
51
src/Modules/Application/Controller/Admin/NavigationTree.php
Normal file
51
src/Modules/Application/Controller/Admin/NavigationTree.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © OXID eSales AG. All rights reserved.
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||
* @author D3 Data Development - Thomas Dartsch <support@shopmodule.com>
|
||||
* @link http://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
namespace D3\DisableAdminElements\Modules\Application\Controller\Admin;
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use DOMXPath;
|
||||
|
||||
class NavigationTree extends NavigationTree_parent
|
||||
{
|
||||
|
||||
/**
|
||||
* clean empty nodes from tree
|
||||
*
|
||||
* @param object $dom dom object
|
||||
* @param string $parentXPath parent xpath
|
||||
* @param string $childXPath child xpath from parent
|
||||
*/
|
||||
protected function _cleanEmptyParents($dom, $parentXPath, $childXPath)
|
||||
{
|
||||
parent::_cleanEmptyParents($dom, $parentXPath, $childXPath);
|
||||
|
||||
$xPath = new DomXPath($dom);
|
||||
$nodeList = $xPath->query($parentXPath);
|
||||
|
||||
foreach ($nodeList as $node) {
|
||||
$id = $node->getAttribute('id');
|
||||
$childList = $xPath->query("{$parentXPath}[@id='$id']/$childXPath");
|
||||
|
||||
$aListOfDisabledElements = Registry::getConfig()->getShopConfVar( 'd3disableAdminElements_elemtentlist');
|
||||
|
||||
foreach($childList as $id => $node) {
|
||||
|
||||
if (in_array($node->getAttribute('id'), $aListOfDisabledElements) ) {
|
||||
$node->parentNode->removeChild($node);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
42
src/metadata.php
Normal file
42
src/metadata.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use D3\DisableAdminElements\Modules\Application\Controller\Admin\NavigationTree as D3NavigationTree;
|
||||
use OxidEsales\Eshop\Application\Controller\Admin\NavigationTree;
|
||||
|
||||
/**
|
||||
* Metadata version
|
||||
*/
|
||||
$sMetadataVersion = '2.1';
|
||||
|
||||
/**
|
||||
* Module information
|
||||
*/
|
||||
$aModule = array(
|
||||
'id' => 'disableadminelements',
|
||||
'title' =>
|
||||
(class_exists(d3utils::class) ? d3utils::getInstance()->getD3Logo() : 'D³') . ' Ausblenden von ungenutzen Menüpunkten im Admin',
|
||||
'description' => array(
|
||||
'de' => 'Tragen Sie in den Einstellungen die id der gewünschten Elemente (Menüpunkte, Tabs etc.) aus den menu.xml Dateien ein und das jeweilige Element wird für alle Adminbenutzer ausgeblendet.',
|
||||
'en' => '',
|
||||
),
|
||||
'thumbnail' => 'picture.png',
|
||||
'version' => '1.0',
|
||||
'author' => 'D³ Data Development (Inh.: Thomas Dartsch)',
|
||||
'email' => 'support@shopmodule.com',
|
||||
'url' => 'http://www.oxidmodule.com/',
|
||||
'extend' => [
|
||||
NavigationTree::class => D3NavigationTree::class,
|
||||
],
|
||||
|
||||
'settings' => array(
|
||||
|
||||
array(
|
||||
'group' => 'd3disableAdminElements_group',
|
||||
'name' => 'd3disableAdminElements_elemtentlist',
|
||||
'type' => 'arr',
|
||||
'value' => array('tbclorder_downloads', 'tbclarticle_files'),
|
||||
),
|
||||
|
||||
),
|
||||
|
||||
);
|
Loading…
Reference in New Issue
Block a user