Knowledge Field Module
The Knowledge Field module provides custom field types used by Knowledge entities. It is a required dependency of the main Knowledge module and is automatically enabled when Knowledge is installed.
Overview
This submodule defines the Proficiency Roles field type (knowledge_proficiency_role), which stores role progression data on the Knowledge Proficiency entity. The field is used internally by the proficiency system and is not exposed in the Field UI.
Components
Field Type: Proficiency Roles
- Plugin ID:
knowledge_proficiency_role - Class:
Drupal\knowledge_field\Plugin\Field\FieldType\ProficiencyRoleItem
Stores progression data for each proficiency role (Candidate, Contributor, Publisher):
| Property | Type | Description |
|---|---|---|
role |
string | The proficiency role identifier |
correct |
int | Number of proficiency criteria met |
total |
int | Total proficiency criteria for this role |
proposer |
int | User ID of the coach who proposed the promotion |
approver |
int | User ID of the approver |
proposed |
int | Timestamp when promotion was proposed |
approved |
int | Timestamp when promotion was approved |
Field Widget
- Plugin ID:
knowledge_proficiency_role - Class:
Drupal\knowledge_field\Plugin\Field\FieldWidget\ProficiencyRoleWidget
Provides the edit form for proficiency roles:
- Role name and correct/total counts
- Entity autocomplete for Coach (proposer) and Approver
- Aggregates values from boolean proficiency fields that have the
proficiency_rolethird-party setting (from Knowledge) assigned
Field Formatter
- Plugin ID:
knowledge_proficiency_role - Class:
Drupal\knowledge_field\Plugin\Field\FieldFormatter\ProficiencyRoleFormatter
Renders the proficiency role values in view mode.
ProficiencyField Helper
- Class:
Drupal\knowledge_field\Utility\ProficiencyField
Static helper that maps proficiency entity field definitions to roles:
ProficiencyField::roleFields($field_definitions)
Returns an array keyed by proficiency role, with each value an array of field names. Only boolean fields with the knowledge.proficiency_role third-party setting (not _none) are included.
Integration with Knowledge
The main Knowledge module:
- Defines the
rolesbase field onknowledge_proficiencyusing this field type - Assigns
proficiency_rolevia third-party settings on boolean fields in the Proficiency Settings form - Uses
ProficiencyField::roleFields()in forms and the Proficiency entity to map fields to roles
Requirements
- Drupal: 11.1+ or 12+
- Dependencies: Main Knowledge module (required)
See Also
- Configuration Guide – Proficiency roles and field mapping
- API Documentation – Technical reference for field types