Skip to content
Roland Toth Pal edited this page Oct 28, 2019 · 61 revisions

Install & uninstall

  1. Install the module as usual (see help here).

  2. Enable or disable submodules and tweak their settings.

To uninstall, follow the instructions on the link above.

Restore settings on next install

Check this checkbox at the bottom of the module to create a file "settings.php" in the module's directory on uninstall containing module data. This file will be imported on next install so you can continue where you have left off.

Additionally you can copy this file to other ProcessWire installations to use the same settings. Make sure to copy the file before installing the module.

Note: the module has to be saved first if you change this feature to take effect. The file also needs to be writable.

Enabling the module

The top of the module's settings page contains a checkbox to toggle the module on/off.

When turned off, the module will be loaded but none of its submodules, and you can re-enable it later, keeping your custom settings.

There's another way to do this: there's a link in the bottom of the footer "Enable/Disable AdminOnSteroids" (on any admin page). Clicking on this link will also enable/disable the module (and reloads the current page). Available only for SuperUsers.

Submodules

This section provides an overview of the available submodules. Each can be enabled or disabled by toggling their checkboxes in the submodule's "panel".

If a submodule is configurable, its panel has a "cog" icon in the bottom-right corner. Clicking on it the page scrolls down to its options.

Available submodules (v0.8.3):

Submodules

For each submodule's documentation see their wiki pages, accessible from the "Pages" sidebar on the right here at GitHub.

Restrict submodules by role

Each submodule has a dropdown "Roles" where you can restrict them by roles. You can find it in the top-right corner in the Submodules section, next to each item's title. By default each submodule is available for all roles. Adding a role will restrict the submodule to users having that role.

Roles dropdown:

Roles

Notes:

  • restrictions are not applied to SuperUsers
  • some submodule is available as SuperUser-only and the roles dropdown is not available for them

Disable submodule or tweak from code

Besides the option to restrict submodules by roles it is possible to use the AdminOnSteroids::modifyConfigData hook to disable a submodule or a tweak inside a submodule.

This is more flexible because you can use custom conditions, eg. remove the sticky header only if the user's name is 'BigBoss' or the page you edit has the 'news' template.

The hook has two arguments that you can use:

  • the module's entire config data
  • the edited Page (or false if it's not applicable)

There are two helper methods you can use:

  • AdminOnSteroids::disableSubmodule to disable a submodule. Parameters: submodule name, config array
  • AdminOnSteroids::disableTweak to disable a tweak. Parameters: submodule name, tweak name, config array

Example:

wire()->addHookAfter('AdminOnSteroids::modifyConfigData', function (HookEvent $event) {

    $data       = $event->arguments[0];
    $editedPage = $event->arguments[1];

    // disable submodule/tweak by template name
    if ($editedPage && $editedPage->template->name == 'news') {

        // disable submodule
        $data = \AdminOnSteroids::disableSubmodule('NavItems', $data);
        $data = \AdminOnSteroids::disableSubmodule('PageListThumbs', $data);

        // remove tweak from submodule
        $data = \AdminOnSteroids::disableTweak('Tooltips', 'tooltipOverlay', $data);
        $data = \AdminOnSteroids::disableTweak('FileFieldTweaks', 'filterbox', $data);
    }

    // disable submodule/tweak by role name
    if ($this->user->hasRole('editor')) {

        // disable submodule
        $data = \AdminOnSteroids::disableSubmodule('Tooltips', $data);

        // remove tweak from submodule
        $data = \AdminOnSteroids::disableTweak('RenoTweaks', 'headSticky', $data);
        $data = \AdminOnSteroids::disableTweak('RenoTweaks', 'sbSticky', $data);
    }

    $event->return = $data;
});

The best place to add the hook is "init.php" but it may work elsewhere too.

You can enable a submodule simply by adding the submodule's name to the enabledSubmodules array (inside the hook):

$configData['enabledSubmodules'][] = 'RenoTweaks';

Add CSS/JavaScript to the admin or change the main logo

At the bottom of the module's settings page there is an "Asset paths" section where you can set a path for a custom admin CSS and JavaScript, and you can set a path to an image file to replace the ProcessWire logo in the header (that is, re-brand the admin).

Use the "Check" button to check if the asset URL you added is valid (available from v1.4.5). Absolute (fully qualified) and relative paths are also accepted. If the "Check" button is green the asset is accessible, red color means it's not (404).

Paths to custom assets:

AssetPaths

Branding logo

If you would like to change the ProcessWire logo in the header, specify a path to a custom logo here. Path needs to be relative to the site root (eg. /site/templates/images/my-logo.png). Use a logo with landscape orientation. The image will be displayed at most about 150px width and 40px height, according to the admin theme used. Note that using the Reno theme and setting "Compact header" will hide the header entirely thus the logo will not be visible.

Auto-loaded files (unavailable from v1.4.5)

(Up to version 1.4.4) There are special files which will be loaded by the module if they exist (no need to manually set their paths above):

  • /site/templates/admin/admin.css: CSS file loaded for the entire admin
  • /site/templates/admin/admin.js: JavaScript file loaded for the entire admin
  • /site/templates/admin/cke.js: JavaScript file loaded for CKEditor fields
  • /site/templates/admin/cke.css: CSS file loaded for CKEditor fields
  • /site/templates/admin/templates.js: fallback for the CKEditor "templates" plugin templates

Extra classes added to "body" tag

The modules adds a few extra classes (user roles, edited page information, etc) to the "body" to make it easier targeting admin pages through CSS and JavaScript. Idea and implementation borrowed from Robin S - thanks!

Module Development

You can contribute to the module development by submitting PRs or reporting issues on GitHub or at the ProcessWire forum topic.

Source assets can be found in the "src" folder. Run npm run watch to watch .scss and .js files in this directory and compile and minify the files in it (thanks to jmartsch).