This module provides an auto-increment (serial) field.
Unlike Drupal's built-in auto-increment node ID, which is global and shared by nodes belonging to all content types, serial fields are managed per content type (D6) / entity (D7). For example, the serial field of an Invoice instance will generate a unique sequential number (starting at 1, then 2, etc.) exclusively for Invoice instances.
The allocation of serial numbers by this module is atomic. In other words, the serial values are unique even when multiple instances of the same content type / entity are created simultaneously.
Dependencies
- Drupal 6 - the CCK module
- Drupal 7, 8 - the core Field module has to be enabled
Optional modules
- Token (http://drupal.org/project/token) - to access serial values as tokens.
- Token + Path Auto (http://drupal.org/project/pathauto) - to use serial numbers in urls, for example:
http://www.example.com/issue/10 (where 10 is a type scope serial number)
instead of:
http://www.example.com/node/64564 (where 64564 is a node id)
Installation
- Copy the serial module directory to your Drupal sites/all/modules/ directory.
- Enable the module in administer > modules (admin/build/modules).
Usage
You can add a serial field to any type at admin/content/types -> manage fields.
In the New Field form select Serial as the type of data and label and field name as your choice, and Save. No other settings.
Notes:
- Existing nodes will also get serial values when a serial field is added.
- The serial token
[{entity_type}:{field_name}]
can be used with Path Auto. All information about available tokens can be found atadmin/config/search/path/patterns
page in Replacements patterns section. - If you're upgrading from Drupal 6, make sure that this module is enabled before the CCK to fields migration. You'll get one or more errors about trying to create tables that already exist, but you can safely ignore these. Feel free to create an issue & patch to fix that.
Similar Modules
Serial numbers can be generated also by the Type-local nids module. The main differences between the two modules are:
- The Serial Field module provides a CCK field.
- ID allocation by Serial Field is atomic (i.e. the same ID cannot be issued to more than one node).
Project information
- Module categories: Site Structure
- 6,585 sites report using this module
- Created by kirsh on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
Fixes a critical bug when adding a new serial field
Development version: 2.0.x-dev updated 1 Mar 2024 at 03:46 UTC
Development version: 7.x-1.x-dev updated 25 Apr 2016 at 20:33 UTC