Backend utilities for Drupal
This module provides a collection of reusable code snippets and traits for common tasks, including Twig, array manipulation, CSV handling, entity management, date and time operations, debugging, file and image handling, JSON and XML processing, and much more. Its aim is to offer failsafe, reusable functionality for various Drupal development needs.
Frequently reusable snippets from Drupal code, that it seemed logical to
abstract into a reusable module code. All snippets are aimed at being reusable and failsafe.
Service name: butils
Sections / Traits
Module contains traits with reusable snippets in current areas:
- Twig
- Arrays
- CSV read/write,
- Current entities,
- Datetime,
- Debugging,
- DomDocument,
- Entitiy,
- Field,
- File,
- HTML,
- ImageStyle,
- JsonAPI,
- Media,
- Menu,
- Paragraphs,
- Redirects,
- SQLQuery,
- State,
- String,
- Taxonomy,
- Truncate,
- Uri,
- User,
- Views,
- XML.
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Release Timeline
Releases
| Version | Type | Core | Notes | Release date | |
|---|---|---|---|---|---|
| 3.0.26 | Stable | 10–11 | Added mediaByUri($uri, $field_name) function to mediaTrait. | Feb 20, 2026 | |
| 3.0.25 | Stable | 10–11 | Add validateEmail() to stringTrait. Validation requires a TLD, which Drupal/PHP validator does not require. | Nov 27, 2025 | |
| 3.0.24 | Stable | 10–11 | Add setSyncing() when metadata updated to avoid revision creation. | Oct 6, 2025 | |
| 3.0.23 | Stable | 10–11 | Add mapKeyValues(). | Sep 22, 2025 | |
| 3.0.22 | Stable | 10–11 | Add default langcode to mapTerm(). | Sep 12, 2025 | |
| 3.0.21 | Stable | 10–11 | Add langcode to mapTerm(). | Sep 1, 2025 | |
| 3.0.20 | Stable | 10–11 | Made arrayMap() public. | Jul 28, 2025 | |
| 3.0.19 | Stable | 10–11 | Edge case: prevent overriding an existing value when inserting a new value after key in arrayInsertAfterKey(). | Jul 17, 2025 | |
| 3.0.18 | Stable | 10–11 | Add arrayInsertAfterKey() that facilitates inserting a value in an array after a given key. | Jul 17, 2025 | |
| 3.0.17 | Stable | 10–11 | Cast translatable markup in labels to string instead of trying to render it. | May 30, 2025 | |
| 3.0.16 | Stable | 10–11 | Fixes <em>domGetBodyHtml()</em> sometimes not identifying html/body inner value correctly. | Mar 27, 2025 | |
| 3.0.15 | Stable | 10–11 | Fixed CSV trait. | Mar 17, 2025 | |
| 3.0.14 | Stable | 10–11 | Misc DomDocument related fixes and sanity checks. | Mar 17, 2025 | |
| 3.0.12 | Stable | 10–11 | Better search and delete in Dom. Fix striptags() bug. | Mar 13, 2025 | |
| 3.0.11 | Stable | 10–11 | Add function bundleHasField() that checks whether an entity type and bundle has a field name in it. | Jan 27, 2025 | |
| 3.0.10 | Stable | 10–11 | Misc fixes. | Jan 23, 2025 | |
| 3.0.9 | Stable | 10–11 | Remove field definition category. | Nov 22, 2024 | |
| 3.0.8 | Stable | 10–11 | Fixes field definition that may cause errors in Drupal 11. | Nov 13, 2024 | |
| 3.0.7 | Stable | 10–11 | Make butils autowired. | Nov 6, 2024 | |
| 3.0.6 | Stable | 10–11 | Added preview widget for the json metadata field type. | Nov 6, 2024 | |
| 3.0.5 | Stable | 10–11 | Adds JSON Metadata fields types. | Oct 24, 2024 | |
| 3.0.4 | Stable | 10–11 | Facilitate file and media image style url generation. | Oct 4, 2024 | |
| 3.0.3 | Stable | 10–11 | Oct 3, 2024 | ||
| 3.0.2 | Stable | 10–11 | Better media support. | Oct 3, 2024 |