Advanced Level (3-4 Years Experience)
13. How do you create a custom REST API endpoint?
- Define a route in `MODULE.routing.yml`
- Create a controller class that returns JSON
- Add `_permission` and `_format` to the route definition
14. How do you create and use services?
- Define the service in `MODULE.services.yml`
- Create a class that implements the service logic
- Inject the service into controllers or plugins using Dependency Injection
15. What is an Event Subscriber? How is it different from a Hook?
An Event Subscriber is an OOP method to respond to system events using the Symfony event
system. Unlike hooks, it allows multiple listeners with execution priority.
16. What are the caching layers in Drupal?
- Page Cache (anonymous users)
- Dynamic Page Cache (for all users)
- Render Cache (stores render arrays)
- Twig Cache (compiled templates)
17. How do you perform a content migration?
- Use Migrate, Migrate Plus, and Migrate Tools modules
- Define source, process, and destination in YAML files
- Use `drush migrate-import` and `migrate-status` to run and monitor
18. How do you migrate files or media and reference them?
- First, migrate files/media entities
- Then reference them in content using `migration_lookup` in process plugins
19. How do you secure a Drupal site?
- Keep modules/core updated
- Use correct file permissions
- Limit user permissions
- Use HTTPS
- Enable security modules like Security Kit
- Validate/sanitize all inputs
20. How do you handle multilingual sites?
- Enable Language, Content Translation, and Interface Translation modules
- Configure language negotiation
- Enable translation per content type or field