Make it possible to configure the output of a boolean field on the formatter level

Created on 18 December 2014, about 10 years ago
Updated 31 March 2023, over 1 year ago

Problem/Motivation

Currently you can configure the output of a boolean field on a field settings level. For views itself though there are more use cases:

  • You want to output 0/1 for raw data output
  • For some nice listings, you might want to support some unicode chars
  • These are the default options + a fully customizable one.
    $default_formats = array(
    'yes-no' => array(t('Yes'), $this->t('No')),
    'true-false' => array(t('True'), $this->t('False')),
    'on-off' => array(t('On'), $this->t('Off')),
    'enabled-disabled' => array(t('Enabled'), $this->t('Disabled')),
    'boolean' => array(1, 0),
    'unicode-yes-no' => array('✔', '✖'),
    );

While we are converting base fields to use field formatters, this lack of support for boolean formatting causes problems in #2342045: Standard views base fields need to use same rendering as Field UI fields, for formatting, access checking, and translation consistency . Once #2342045: Standard views base fields need to use same rendering as Field UI fields, for formatting, access checking, and translation consistency gets in, not having all those options available on the boolean formatter would be a regression.

Proposed resolution

Extend the boolean field formatter with options to support these display formats. This will allow #2342045: Standard views base fields need to use same rendering as Field UI fields, for formatting, access checking, and translation consistency to not regress functionality for boolean fields.

Remaining tasks

Commit.

User interface changes

Boolean fields have more flexible display formats.

API changes

The boolean formatter schema is slightly expanded.

Beta phase evaluation

<!--Uncomment the relevant rows for the issue. -->
📌 Task
Status

Fixed

Version

8.0 ⚰️

Component
Field 

Last updated about 19 hours ago

Created by

🇩🇪Germany dawehner

Live updates comments and jobs are added and updated live.
  • VDC

    Related to the Views in Drupal Core initiative.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
Production build 0.71.5 2024