${LAYER} not working in PCBNew print or plot

Steps to reproduce

  1. Add "Layer: ${LAYER}" to the worksheet.
  2. Print or plot with worksheet shown.

KiCad Version

Application: KiCad

Version: (6.99.0-2122-gbce1fd337b), debug build

Libraries:
	wxWidgets 3.1.5
	FreeType 2.11.1
	HarfBuzz 3.2.0
	FontConfig 2.13.1
	libcurl/7.68.0 OpenSSL/1.1.1d zlib/1.2.11 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0)

Platform: macOS Catalina Version 10.15.7 (Build 19H1922), 64 bit, Little endian, wxMac

Build Info:
	Date: Jun 10 2022 14:11:02
	wxWidgets: 3.1.5 (wchar_t,STL containers)
	Boost: 1.76.0
	OCC: 7.5.1
	Curl: 7.68.0
	ngspice: 31
	Compiler: Clang 11.0.0 with C++ ABI 1002

Build settings:
	KICAD_USE_OCC=ON
	KICAD_SPICE=ON
	KICAD_STDLIB_DEBUG=OFF
	KICAD_STDLIB_LIGHT_DEBUG=OFF
	KICAD_SANITIZE_ADDRESS=OFF
	KICAD_SANITIZE_THREADS=OFF