implements a short link system for nodes and taxonomy terms, removes deprecated jQuery dependency, and refactors the SimpleSocialShareBlock to follow Drupal best practices using dependency injection.
### 1. Short Link System
- **New Controller**: Created `src/Controller/ShortLinkController.php` with two methods:
- `redirectNode()` - Handles short links for nodes via `/n/{node}`
- `redirectTaxonomyTerm()` - Handles short links for taxonomy terms via `/t/{taxonomy_term}`
- **New Routes**: Added `simple_social_share.routing.yml` with:
- `simple_social_share.node_short_link` - Route for node short links
- `simple_social_share.taxonomy_term_short_link` - Route for taxonomy term short links
- **Block Integration**: Updated `SimpleSocialShareBlock` to automatically generate short links when displaying on node or taxonomy term pages
### 2. Dependency Injection Refactoring
- Refactored `SimpleSocialShareBlock` to implement `ContainerFactoryPluginInterface`
- Replaced all static `\Drupal::` calls with properly injected services:
- `RouteMatchInterface` for route matching
- `TitleResolverInterface` for page title resolution
- `RequestStack` for request handling
- Added constructor and `create()` method for proper dependency injection
- Improves testability, maintainability, and follows Drupal coding standards
Comments
Comment #3
ahmad-alyasaki commented