|commuter_class

  • New in : SPIP 4.0

The |commuter_class filter compares the provided classes to the classes present in an HTML tag. The filter removes classes already present and adds classes that did not exist.

Example

#LOGO_RUBRIQUE

Produces the following HTML:

<img
	src="IMG/logo/essai-1.jpg?1614197741"
	class="spip_logo"
	width="800"
	height="600"
	alt=""/>

Let’s apply the |commuter_class filter with the ’nav spip_logo menu’ argument:

[(#LOGO_RUBRIQUE|commuter_class{nav spip_logo menu})]

The classes ’nav’ and ’menu’, which are absent, are added, and the class ’spip_logo’, which is already present, is deleted.
The result is:

<img
	src="IMG/logo/essai-1.jpg?1614197741" class='nav menu'
	width="800"
	height="600"
	alt=""/>

See also

Author jack Published : Updated : 20/04/23

Translations : English, Español, français