This project is not covered by Drupal’s security advisory policy.
Introduction
Logic Formatter apply logic operation to field values (keys for list_*, ids for entity_reference)
and output plain text or markup based on boolean result.
Field types supported
Logic formatter module provide field formatters for next core field types:
- entity_reference,
- list_integer,
- list_float,
- list_string
Operations supported
- Any IN,
- Any NOT IN,
- All IN,
- All NOT IN,
- EXPR
First four operations just test field values against space separated list of values specified by operand setting.
EXPR calculate specific expression specified by operand setting.
EXPR operation expression examples
Space separated lists of values for exact match or include/exclude. Note: field values compares as strings.
A B C: Exact match. True then field contains 'A' and 'B' and 'C' and nothing else.
: True then field contains nothing.
A B ! C D: Include/exclude. True then field include 'A' and 'B' and not include 'C' or 'D'.
A B C !: True then field include 'A' and 'B' and 'C' and anything else.
! A B C: True then field not include 'A' or 'B' or 'C'.
The char '^' in first position of values list specify result negation.
^ A B C: Negation of exact match. True then not (field contains only 'A' and 'B' and 'C').
^: True then field not empty.
Logic alternatives can be specified with '|' char.
A | B C | D E ! F: Thue then (contains only 'A') OR (contains only 'B' and 'C') OR (include 'D' and 'E' but not 'F').
|A!: True then field empty or include 'A'.
A!|^B!C: True then field (include 'A') or (not(include 'B' and not include 'C')).
Requirements
This module requires no modules outside of Drupal core.
Installation
Install the logic_formatter module as you would normally install a contributed
Drupal module. Visit https://www.drupal.org/node/1897420 for further
information.
Project information
- Project categories: Site structure
3 sites report using this module
- Created by altside.ru on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.

