Drupal developer interview questions and how to answer them
Drupal developer interview questions test whether you build with Drupal's systems instead of around them: content modeling with entities and fields, custom modules using services, hooks, events and plugins, render arrays with correct cache metadata, Twig theming, configuration management between environments, migrations and secure coding. Agencies and in-house teams often add a code review or a small module task. Strong candidates explain why a feature belongs in configuration, a contributed module or custom code.
By Evin JohnPublished 7 min read
What Drupal developers work on
Drupal is used for large content sites, government and university portals, intranets and multilingual publishing. Back-end Drupal developers build custom modules, integrate external systems, write migrations and tune performance. Front-end or themer roles build Twig templates, component libraries and accessible themes. Site builders configure content types, views and permissions without much code. Many jobs mix all three, which is why interviews jump between architecture and very practical questions. Modern Drupal is built on PHP with Symfony components and Composer, so general PHP knowledge is assumed.
- Drupal way first: knowing which core or contributed module already solves a problem before writing code.
- Clean custom code: services with dependency injection, plugins and event subscribers in the right places.
- Performance and caching: correct cache metadata so pages are fast and still accurate for each user.
- Deployment discipline: Composer, configuration export and import, and Drush in a repeatable workflow.
- Security and accessibility: safe output, access checks and markup that works for everyone.
How Drupal interviews are usually structured
- ScreenDrupal versions you have worked on, the kind of sites, your role, and contributions to modules or issues if any.
- Technical interviewArchitecture questions on entities, modules, caching, configuration and security, often with real scenarios from their projects.
- Practical task or code reviewA small custom module, a block plugin, a migration, or a review of existing code with problems planted in it.
- Team interviewHow you estimate, handle client changes, review code and work with designers and content teams.
Content modeling and site building questions
| Question | What it tests | What a strong answer shows |
|---|---|---|
| What is an entity, and how do bundles and fields relate to it? | Data model | Entities are content or configuration objects; bundles such as content types group them; fields add data to a bundle |
| Content entity or configuration entity? | Model choice | Content entities hold site data that editors create; configuration entities hold settings that move between environments |
| When would you create a custom entity type instead of a content type? | Architecture judgment | When the data is not editorial content, needs its own storage, access rules or listing, or would bloat the node table |
| How would you model an event with sessions and speakers? | Modeling skill | Separate entities linked by entity references, reusable speakers, and views for listings, with editors' workflow in mind |
| What are Views, and when would you write a custom query instead? | Using core | A query builder for lists and pages; custom code only when performance or complex logic require it |
| How do you handle multilingual content? | Translation | The language and translation modules, field-level translatability decisions and translated configuration |
Module development questions
- What files make a minimal custom module? An info.yml file, plus routing, services or other YAML and PHP classes as the module needs; the .module file only for procedural hooks.
- What is a service, and why use dependency injection? A reusable object registered in the service container; injecting dependencies through the constructor makes code testable and avoids static calls.
- Hooks or event subscribers? Events for things Symfony and Drupal dispatch as events, such as requests; hooks for Drupal's alter and info systems. Drupal 11 also allows hooks as class methods marked with a #[Hook] attribute.
- What is a plugin, and give examples. Swappable classes discovered by a plugin manager, such as blocks, field formatters, field widgets and migrate sources; newer versions declare many with PHP attributes where older code used annotations.
- How do you add a form? A class extending a form base with build, validate and submit methods, using the Form API and its built-in protection against forged submissions.
- How do you call an external API safely? Inject the HTTP client service, set timeouts, handle failures, cache results and keep credentials out of configuration exports.
hello.page:
path: '/hello/{name}'
defaults:
_controller: '\Drupal\hello\Controller\HelloController::page'
_title: 'Hello'
requirements:
_permission: 'access content'<?php
namespace Drupal\hello\Controller;
use Drupal\Core\Controller\ControllerBase;
final class HelloController extends ControllerBase {
public function page(string $name): array {
return [
'#markup' => $this->t('Hello @name', ['@name' => $name]),
'#cache' => ['contexts' => ['url.path']],
];
}
}Caching and performance questions
| Question | What it tests | What a strong answer shows |
|---|---|---|
| What are cache tags, contexts and max-age? | Cache metadata | Tags say what data the output depends on so it can be invalidated; contexts say what it varies by, such as user roles or language; max-age says how long it may live |
| A block shows one user's name to another user. Why? | Context bugs | Missing a user cache context, so the first rendered version was cached and served to everyone |
| A node edit does not show up on a listing. Why? | Tag bugs | The listing's render array lacks the right list cache tag, so saving the node did not invalidate it |
| What do BigPipe and auto-placeholdering do? | Personalized pages | They send the cacheable page first and fill in personalized parts later, so one user-specific block does not stop page caching |
| How would you find a slow page? | Profiling | Check caching first, then database queries and external calls with profiling tools, and fix the biggest cost |
Theming and front-end questions
- How does Twig template naming and overriding work? Theme suggestions from general to specific, such as by content type or view mode, with debug mode showing which template is used.
- What is a preprocess function for? Preparing variables for a template so Twig stays simple; keep business logic out of templates.
- How do you add CSS and JavaScript? Libraries defined in a libraries.yml file and attached where needed, not loaded on every page.
- How do you keep a theme accessible? Semantic markup, visible focus, labeled form elements, color contrast and testing with a screen reader and keyboard.
- What are single directory components? A way to keep a component's template, styles, scripts and metadata together, used in recent Drupal versions for design systems.
Configuration, deployment and upgrade questions
- How do you move a new content type from development to production? Export configuration to YAML, commit it, deploy code and import configuration with Drush in the release process.
- What do you do about settings that differ per environment? Configuration split or overrides in settings files, and secrets in environment variables.
- How do you update core and modules? With Composer, in a branch, run database updates and configuration import, test, then deploy the same steps.
- How would you migrate a Drupal 7 site? Audit content and modules, decide what to rebuild rather than port, use the Migrate API with custom source or process plugins where needed, and run repeatable test migrations. Drupal 7 reached its end of life in early 2025, so many of these projects are urgent.
- How do you prepare for a major version upgrade? Remove deprecated code reported by tools such as Upgrade Status, update contributed modules and test on a copy.
Security questions
- How do you prevent cross-site scripting in Drupal? Let Twig and the render system escape output, use translation placeholders, and filter any HTML you must allow.
- How do you avoid SQL injection? Use the database API with placeholders or the entity query system, never concatenated SQL.
- How do you control access to a custom route? Requirements in routing, custom access checks where needed, and entity access checks on queries that list content.
- How do you handle security advisories? Follow the security team's announcements, apply updates quickly, and keep a process for emergency releases.
Fictional example
- On a university site, the home page was slow for logged-in staff but fast for visitors. Profiling showed a custom block listing upcoming events that ran an expensive query on every request. The block had a max-age of zero because a developer had set it to stop stale listings, which also disabled caching of the whole region for logged-in users. I gave the block the event list cache tag and a sensible max-age based on the next event's start time, so saving an event cleared it and the list rolled over on schedule. I also added the user roles cache context only where staff saw extra links. Page times for staff dropped to close to those for visitors, and the stale-listing problem did not come back.
For the language round, see the PHP and Laravel guide; for general web questions the web developer guide and the backend developer guide. Community sites often pair Drupal with chat tools, and the Discord bot developer guide covers that side.
Two more Drupal questions
- How do you write automated tests for a custom module? Unit tests for plain logic, kernel tests for code that needs services or the database, and functional tests for pages and forms.
- How do you decide between a contributed module and custom code? Check the module's maintenance, security coverage and fit, and prefer it when it solves most of the need; write custom code for the rest.
A ten-day preparation plan
- Days 1 to 3: build a small custom module with a route, a service injected into a controller, a block plugin and a config form.
- Days 4 and 5: add correct cache metadata to the block and prove it with two users and an edit.
- Days 6 and 7: export the configuration, rebuild the site from code on a fresh install and import it with Drush.
- Days 8 and 9: write a small migration from a CSV file and run it repeatedly.
- Day 10: rehearse explaining the caching bugs above, and prepare questions about the employer's Drupal versions and hosting.
In practice rounds, Natively, an AI interview assistant for Mac and Windows, can read a code review task or a PHP question from a screenshot and suggest what to look for, and it transcribes your spoken walkthrough so you can see whether you explained cache tags and contexts clearly. Each session's transcript and notes stay saved for the next one.
Questions people ask
What questions are asked in a Drupal developer interview?
Questions about entities, bundles and fields, custom modules with services, hooks, events and plugins, render arrays and cache metadata, Twig theming, configuration management, migrations, upgrades and secure coding.
What are cache tags and cache contexts in Drupal?
Cache tags record what data output depends on so it can be invalidated when that data changes; cache contexts record what the output varies by, such as user roles or language.
How do I explain configuration management in a Drupal interview?
Describe exporting configuration to YAML, committing it, deploying code and importing configuration with Drush, with environment-specific settings kept in overrides or splits.
Do Drupal interviews include a practical task?
Often a small custom module, a block plugin, a migration or a review of existing code with planted problems, followed by a discussion of your choices.
Where to go next
Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.
Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.
