Top 50 Drupal interview questions and answers
1. What is Drupal?
Drupal is a free, open-source Content Management System(CMS). Drupal CMS written in PHP. It’s used to make many of the websites and applications.It has standard features, like simple content authoring, reliable performance, and excellent security.
2. Why Drupal is most powerful CMS compare to other CMS ?
Basically Drupal use content construction kit, It allows you to create multiple content types without any programming code. Each content type it allows customize theme template. You can have an article, story, slideshow, content type and many more.Drupal has excellent security.
3. What is hook system in Drupal. How and why would you use it?
Drupal’s hook system is use for implement the custom features without any need to make any modifications to the Drupal core functionality. There are specific places where the Drupal core can invoke custom functions defined in modules to enhance the functionality of core. These places are referred to as “hooks” and have a well-defined interface.
Hooks make it possible, for example, for a module to define new URLs and pages within a site (hook_menu), to add content to pages (hook_block, hook_footer, etc.), set up custom database tables (hook_schema), and many more.
If you want to change the core “Contact” form. To do so, you can implement hook_form_alter in your custom module and provide any custom functionality that you’d like in that function. Drupal will check all form_alter hooks in all modules, so your hook will be picked up and your custom code will be applied to the “Contact Form”.
So overall, Drupal hooks are just functions defined as per the Drupal standards that allow you to extend Drupal and alter or extend core functionality without modification any core code.
4. How caching work in Drupal?
Drupal provide a standard caching feature. It allows to speed up website using different configuration as like page caching, block caching and lifetime for cached pages.
- Page Caching: Drupal enables the entire HTML of each page to be stored in the database. It reduces the amount of queries needed.
- Block Caching: Set the cache setting for a block in views, when block created by views.
- Minimum cache lifetime: You can set the particular amount of time before the page cache is cleared. When will cron run, page caches are cleared.
- Expiration of cached pages: Expiration of cached pages applies for an external mechanism as like browser cache or varnish.
5. What is DRUSH in Drupal?
Basically, DRUSH is a command line shell and UNIX scripting interface for Drupal.
6. List of the SEO modules in Drupal?
There are many SEO module available in Drupal.
- Meta tags/ Node words
- Service Links
- Google Analytics
- Related Links
- Search 404
- Site map
- Url list
7. What is Drupal cron?
Drupal cron executes commands or scripts automatically at specified time and date intervals, you can use Drupal cron.
8. Which files are required for theme?
These files are required for theme.
9. Which files are required for module?
- modulename.info – required file
- modulename.module – required file
- modulename.install – optional file
10. Where can you use the theme hook?
11. How can you use the multiple themes in application?
You can use the global variable, default_theme.
12. How can you set the region in Drupal theme?
You can set the regions in yourthemename.info file.
regions[header] = Header
regions[content_header] = Content Header
regions[content] = Content
regions[sidebar_second] = Right sidebar
13. Can we use Drupal on the Command Line?
Yes, you can use drush. Drush is a command line shell and Unix scripting interface for Drupal.
14. Is it possible to disable the core required modules through Drupal admin ?
No, it is not possible to disable the core required modules.
15. What is module in Drupal?
A module is set of codes that extends Drupal functionality/feature.
There are two types of Drupal module.
- Core modules :These modules are included default in Drupal, and you can turn on their functionality without installing additional software.
- Contributed modules:These modules are downloaded from the Modules download section of drupal.org, and installed within your Drupal installation.
You can create your own custom module and Drupal’s module API using PHP programming language.
16. How do you handle upgrades in Drupal?
Upgrade Drupal with minor version change.
- Back up your application,
- Put your application into maintenance mode
- Download the new version of module
- Uncompress the module
- Run the update.php
- Test the application
- Make the application out of maintenance mode
Upgrade Drupal with major version change.
- Backup your existing site and database.
- Log in with Drupal admin using your credential
- Put your site in maintenance mode
- Change all themes to Default Theme
- Disable non-core modules
- Remove default settings file
- Remove all old core files and directories
- Remove uninstalled modules
- Download Drupal 7
- Re-apply modifications to core files
- Make your PHP file writeable
- Run the update script
- Backup your database
- Upgrade all fields
- Update contributed modules and themes
- Check the Status Report
- Make sure settings.php is secure
- Check Drupal Core Modules
- Remove your application from Maintenance Mode
17. What is the Sub-Theme?
A Drupal Sub-Theme is a child theme that is based on a “base theme”. The base theme provides basic functionality. The Sub-Theme styles the site with a unique look, and adds any unique extra functionality. If you update your theme. Then your base theme only updated and Sub-Theme remain same. It will not update.
18. How to update Drupal using Drush command?
Steps to update Drupal 7 core using Drush
- Backup your application/site.
- Put your application in maintenance mode/Offline mode.
drush vset --exact maintenance_mode 1
drush cache-clear all
- Update Drupal with Drush command.
drush pm-update drupal
- Check your setting.php file configuration.
drush vset --exact maintenance_mode 0
drush cache-clear all
- Put your application online again OR Remove your application maintenance mode.
Now you can see your application updated and it is working fine.
19. What are the features of Drupal?
Features of Drupals as listed below:
– Open Source CMS
– Flexible and Robust CMS in comparison to Others CMS.
– Provide High Security layer.
– Easy Way to manage Content Type.
– Fields and Blocks that are the most flexible assets of Drupals.
20. What is a Block?
Blocks are the layout elements. A block defines that what particular content should be displayed at what place in the layout. It is a box in the content area.
21. What are the regions?
Regions are the layers defined by theme to re-present the content area. For example header, footer, sidebar etc.
22. What is a node?
All the contents are treated as a node in Drupal. A node is a chunk of content. We can create content, custom content using node module.
23. What is a taxonomy?
Taxonomy is used to organize Meta-data, tags, categories in Drupal. It a feature of Drupal core. It is used to categorize the content of the website. We can use tags to connect the content.
24. What is service.yml?
service.yml placed in the root directory in and all the services are defined here.
25. What is the settings.php?
This is the global settings of the site.The database, URL structure, salt, encryption etc all the variables are defined here.
26. What is the clean URL?
SEO friendly URLs in Drupal is clean URL.We can enable or disable it.
27. How can we manage clean URL in Drupal CMS?
You can enable or disable clean URLs by following steps:
– Navigate to Administer > Configuration > Search and metadata > Clean URLs.
– Wait for the automated Clean URLs test to run.
– Checked or Unchecked the Enable clean URLs checkbox.
– Click “Save configuration”
28. What is a URL alias?
We can add our custom URL in place of “node”. It makes URL clean and SEO friendly.
29. What does cron do in Drupal?
Cron deletes temporary files and trigger the search module to index the content on the site.It pings modules to get updates.
30. What is a Report in Drupal?
Reports modules collect the whole site report and logs report.It does the following task:
– Recent log entries
– Top ‘access denied’ errors
– Top ‘page not found’ error
– Available updates
– Status Report
– Site statistics
31. What are the content types in Drupal?
Contents are categorised into two basic categories:
1- Basic pages
32. What is a Basic page content?
Basic Page is the landing pages for a site, that rarely change. If we are creating About us, Contact us, Services pages then we can choose Basic Page type content.
33. What is a Article type content?
Article type is a regular blog post on the site. We can select Article if we are writing an article or blog posts related to latest updates etc.