Provides easy front-end admin bar for editing page content in ProcessWire.

AdminBar module for ProcessWire CMS/CMF

This module provides easy front-end admin bar for editing page content in ProcessWire.

Credits


This module was originally developed by @apeisa, with additional development by Teppo Koivula. Credits for the bundled themes:

Installing the module


This module can be installed just like any other ProcessWire module: copy or clone the directory containing this module to your /site/modules/ directory, log in, go to Admin > Modules, click "Check for new modules", and install "AdminBar".

Alternatively you can use the module installer in ProcessWire's Admin or Composer to install this module. The module is available via Packagist for Composer installation as teppokoivula/admin-bar.

Requirements

  • ProcessWire >= 3.0.112
  • PHP >= 7.1.0

If you're running an earlier version of ProcessWire or PHP, you can use the 1.1.5 release of this module instead. Note, though, that 1.x branch of the module is no longer supported, and as such it may not work as expected, and will lack some of the features available via the 2.x branch.

Permissions


By default AdminBar is visible only for superusers only. If you want to grant non-superusers access to AdminBar, please add permission "adminbar" to their role(s).

If you are upgrading from an older version of AdminBar, you may need to uninstall and then reinstall the module in order to see that permission. Alternatively you can add this permission manually: just provide "adminbar" as the name of the permission (the label doesn't really matter).

Themes


AdminBar comes with a selection of built-in themes. You can change the theme via module config, and if you want you can also create a custom theme of your own:

  1. Create directory for your custom theme anywhere under your site directory. This directory should contain at least theme.css file, but you can also include theme.js, theme.php, and config.php.

    For examples on how theme files work, check out the uikit theme, found from the /themes/uikit/ directory within the AdminBar directory.

  2. Select "Custom ..." option for theme in module config.

  3. Type into the "Custom theme" text input the path to the directory your custom theme's files are located in. This path should be relative to (start from) your site directory.

Hooks


As with any ProcessWire module, you can identify hookable methods by the three underscores before the method name: ___hookableMethod(). Here are the details regarding typical "hooking points" provided by the AdminBar module:

  • ___render(): this method renders the Admin Bar. You can hook before it if you want to provide custom arguments for the method (overriding strings etc.) or you can hook after it if you want to manually modify the returned output string.
  • ___getTemplates(): this method returns the "template strings" used by the render method. These are essentially the parts that make up the final markup, and if you want to modify the markup of the Admin Bar, you can hook after this method and modify the returned template strings array.
  • ___getData(): this method returns the value of the data-adminbar attribute added to the Admin Bar. If you need custom properties mainly for JavaScript use, you should hook after this method and modify the returned array of options.
  • ___getItems(): this method returns a list of items displayed in the Admin Bar. You can modify certain aspects of these items (strings/labels, use of modal links, etc.) by hooking before this method and modifying the args array – or if you want to modify the displayed items, you can hook after this method and modify the returned array of items.

Frontend utilities


You can use the data-adminbar-adjust attribute to control behaviour of frontend elements while Admin Bar is enabled/displayed. This attribute should contain a space-separated list of CSS properties that should be modified when Admin Bar height is recalculated.

Example and supported values:

<div data-adminbar-adjust="top max-height"></div>

Adjustments are applied as inline CSS styles. Assuming that the height of the Admin Bar was 100px at the time of calculation, the example above would result in...

<div style="top: 100px; max-height: calc(100% - 100px);" data-adminbar-adjust="top max-height"></div>

License


This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

(See included LICENSE file for full license text.)

Install and use modules at your own risk. Always have a site and database backup before installing new modules.

Twitter updates

  • ProcessWire 3.0.187: This week we have some very useful new additions to both the core Repeater Fieldtype and the ProFields Repeater Matrix Fieldtype. This post covers all the details along with a couple of brief demonstration videos— More
    22 October 2021
  • ProcessWire 3.0.185 (dev) core updates, plus new Session Allow module— More
    17 September 2021
  • Three new ProcessWire Textformatter modules: Find/Replace, Markdown in Markup, and Emoji— More
    3 September 2021

Latest news

  • ProcessWire Weekly #389
    The 389th issue of ProcessWire Weekly we'll check out the latest core updates, introduce the Session Viewer module, and more. Read on!
    Weekly.pw / 23 October 2021
  • New Repeater and Repeater Matrix features
    This week we have some very useful new additions to both the core Repeater Fieldtype and the ProFields Repeater Matrix Fieldtype. This post covers all the details along with a couple of brief demonstration videos. 
    Blog / 22 October 2021
  • Subscribe to weekly ProcessWire news

“Indeed, if ProcessWire can be considered as a CMS in its own right, it also offers all the advantages of a CMF (Content Management Framework). Unlike other solutions, the programmer is not forced to follow the proposed model and can integrate his/her ways of doing things.” —Guy Verville, Spiria Digital Inc.