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_datain,render_block_core/navigationout), so the Log in/out filter knows whether it is inside one. - The SVG has the class
lh-membership-loginout-icon, isaria-hidden, 1em square and drawn incurrentColor. 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, keyedloginandlogout, each an array ofviewboxandpath.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.)

