Install
Works with Drupal: ^10 || ^11Using Composer to manage Drupal site dependencies
Alternative installation files
Release notes
# Entity Attributes Field 1.0.1
This release modernizes the EAF module for Drupal 11 compatibility with comprehensive refactoring to follow current best practices.
## What's New
### Drupal 11 Compatibility
- **Hook API Migration**: Converted all procedural hooks to the new Hook API using PHP 8 `#[Hook()]` attributes
- **Dependency Injection**: Refactored `FieldAttributeService` to use proper constructor injection instead of `\Drupal::service()` calls
- **PHP 8 Attributes**: Modernized all PHPUnit tests from doc-comment annotations to native PHP 8 attributes
### Code Quality Improvements
- **Coding Standards**: Achieved 100% compliance with Drupal and DrupalPractice coding standards (0 errors, 0 warnings)
- **Type Safety**: Added nullable type hints throughout the codebase (`?string`, `?TypedDataInterface`)
- **Array Formatting**: Fixed indentation and formatting across all array structures
- **Documentation**: Enhanced doc comments with proper formatting, spacing, and @deprecated annotations
### Testing
- **PHPUnit 11 Support**: Migrated test suite to use PHPUnit 11 attributes (`#[CoversClass]`, `#[Group]`, `#[DataProvider]`)
- **Test Stability**: Fixed all unit tests to work with the new dependency injection pattern
- **Test Coverage**: Maintained 100% passing rate for all existing unit tests
### Bug Fixes
- Fixed constructor initialization in test files
- Corrected service definitions in `eaf.services.yml` with proper dependency arguments
- Resolved deprecated PHPUnit method usage
- Fixed container initialization issues in unit tests
## Technical Details
### Breaking Changes
**None** - This release maintains backward compatibility while modernizing the internal architecture.
### For Developers
- `FieldAttributeService` now requires two constructor arguments: `EntityAttributePluginManagerInterface` and `EntityFieldManagerInterface`
- All hooks have been moved to `src/Hook/EafHooks.php` using the modern Hook API
- PHPUnit tests now use PHP 8 attributes instead of doc-comment annotations
### File Changes
- **Modified**: `src/FieldAttributeService.php` - Added dependency injection
- **Modified**: `eaf.services.yml` - Added service arguments
- **New**: `src/Hook/EafHooks.php` - Centralized hook implementations
- **Modified**: `eaf.module` - Removed procedural hooks
- **Modified**: All test files in `tests/src/Unit/` - Migrated to PHP 8 attributes
## Requirements
- **Drupal**: ^10.3 || ^11
- **PHP**: ^8.1
- **PHPUnit**: ^11.5 (for testing)
## Upgrade Path
No special upgrade steps required. Simply update the module and clear caches.
```bash
composer update drupal/eaf
drush cr
Credits
This release represents a significant modernization effort to ensure long-term maintainability and compatibility with current Drupal standards.
---
Full changelog: https://git.drupalcode.org/project/eaf/-/compare/1.0.0...1.0.1
---