Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

token_number_sprintf

No security coverage Maintenance fixes only 49 sites

Part of the Token ecosystem · 21 projects

This module allows you to format numerical fields (decimal, float, integer) using `sprintf` formatting strings. It's useful for tasks like generating entity labels that require numbers to be padded with leading zeroes or displayed in a specific decimal format.

This module adds a dynamic "Formatted" token for decimal, float, and integer fields that allows the use of a sprintf formatting string to format the number.

Note that this is a simple application of the function using a single value:

sprintf($your_format_string, $numeric_field_value);

A formatting string that expects multiple values will produce no output.

Use case

We had a need for this functionality when we needed to generate automatic entity labels for nodes that included a number field, and needed that number padded with leading zeroes in the labels.

Drupal 10–11

Ask your assistant about token_number_sprintf

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

  • field Drupal core
  • system Drupal core >= 10.0

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Feb 2023
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Active

Releases

Version Type Core PHP Release date
2.3.0 Stable 10–11 Mar 27, 2025
2.2.0 Stable 8–10 Feb 3, 2023