Digital Sovereignty for everyone

Log in/out icon

A Log in/out block placed inside a Navigation block and given a CSS class starting icon- (for example icon-user) gets an inline SVG icon before its link text: a user icon when logged out and a log-out icon when logged in. The block’s wrapper gets the has-inline-icon class, so a theme can skip its own pseudo-element icon, as LH 2015 does in its social menu.

Left untouched: Log in/out blocks without an icon- class (plain text links in a footer menu, say), blocks outside a Navigation block, and blocks set to show the login form.

How it works

  • Navigation blocks are tracked while they render (render_block_data in, render_block_core/navigation out), so the Log in/out filter knows whether it is inside one.
  • The SVG has the class lh-membership-loginout-icon, is aria-hidden, 1em square and drawn in currentColor. A one-line style giving it a small end margin is enqueued only on pages that draw it.
  • In the block editor, which renders the block without the filter, the log-out icon is previewed as a CSS mask on Log in/out blocks with an icon- class inside Navigation blocks.

Filters

  • lh_membership_return_loginout_icons ( array $icons ): the icons, keyed login and logout, each an array of viewbox and path.
  • lh_membership_loginout_show_icon ( bool $show, array $block ): whether this block gets the icon.

The code is includes/lh-membership-loginout-icon-class.php. (Since 2.108.0; limited to blocks with an icon- class since 2.108.1.)

If you like this plugin please consider making a donation to further development

Install LHero.org

lhero.org

Open it straight from your home screen, full screen and quicker to load.

  1. Tap the Share button . If you cannot see it, tap ••• first.
  2. Scroll down and tap Add to Home Screen.
  3. Tap Add.
  1. Tap the browser menu â‹®.
  2. Tap Install app or Add to Home screen.
  1. In the menu bar, choose File, then Add to Dock.

Use your browser's menu to install this site or add it to your home screen.