Drupal Interview questions
Tags: interview, php, drupal
Published: 2022-07-19 21:58:29

**- What is the entity in Drupal?**
In Drupal, **entity** is a general concept that represents a noun (person, place, or thing). Out of the box, there are a number of different types of entities in Drupal, _each meant to represent a specific type of data. _
Such as **user** and **Content**

Entity has two types **Configuration** and **Content**
Content such as [User, Node, Taxonomy]

**Bundle** is a subtype of content entity such as [Article, Basic page, Term]

**- Difference between Field Types, Field Formatters and Field Widgets?**
_Field Types_ this defines the type of value that will be stored in database [integer, string...].
_Field Widgets_ this using in edit value and configured from form display.
_Field Formatter_ this defines how value will be rendered and displayed configured from manage display.

**- What is rendered array?**
The core structure of Drupal's Render API is the render array, which is a hierarchical associative array containing data to be rendered and properties describing how the data should be rendered.

**- Cache in Drupal**
A cache stores frequently requested pages or the parts of the pages, and these pages can be shown to users with fewer resources and with a faster speed than usual.

Drupal 8 enables two modules: Internal Page Cache and Internal Dynamic Page Cache. Internal Page Cache caches pages for anonymous users. Internal Dynamic Page Cache caches contents of the page except for the personalized pieces, so they can be used for anonymous and authorized users. Each object of the page contains metadata, and this piece of metadata tells the Internal Dynamic Page Cache module if it must cache the page or not.

**- Create custom token**
[Create custom token] (https://codimth.com/blog/web/drupal/how-create-custom-token-drupal-8-9)

**- Create custom Drush command**
[Drush command] (https://www.specbee.com/blogs/writing-your-own-custom-drush-9-and-10-commands)

**- Can we optimize any Drupal website? If yes, then how? **
Ans: Yes, we can do it. The steps are given below:

- Enable page caching
- Compress CSS files
- JS Aggregation
- Moving media files and static files to CDN
- Theme optimization

**- How hooks working in Drupal?**
Hooks are how modules can interact with the core code of Drupal.
Hooks allow modules to alter and extend the behavior of Drupal core, or another module. They are one of the various ways that code components in Drupal can communicate with one another. Using hooks, a module developer can change how core, or another module works -- without changing the existing code.

**- How Drupal handles the page request: Bootstrap Process? **
[LINK](https://www.valuebound.com/resources/blog/how-drupal-handles-page-request-bootstrap-process)
What Drupal does:

1. Separates the internal path from the full URL.
2. Bootstraps and initialize the database, sessions etc.
3. Maps the path to a callback function.
4. Modules can hook into the process and extend functionality and 
   alter the content.
5. The Theme System generates the HTML and styles it.
6. Drupal returns a fully formed HTML page to the browser
7. The browser renders the HTML page for the user

**How to use multiple databases in Drupal 8**
[Article](https://codimth.com/blog/web/drupal/how-use-multiple-databases-drupal-8)

**Drupal Event Subscriber**
[Article](https://www.daggerhartlab.com/drupal-8-hooks-events-event-subscribers/)

**Why are we using module `config ignore`?**
Ignore config files you don't need to upload it.

**[Rest API in Drupal] (https://drupalize.me/blog/201401/introduction-restful-web-services-drupal-8)**

## **Apigee With Drupal**

**[Apigee Edge](https://www.drupal.org/docs/contributed-modules/apigee-edge)** : 
The Apigee Edge module lets you connect your Drupal developer portal site with Apigee Edge, Apigee X, and Apigee hybrid organizations.

**[Apigee API Catalog](https://www.drupal.org/docs/contributed-modules/apigee-api-catalog)**: 
Apigee’s API Catalog module lets you document your APIs in your Drupal developer portal using OpenAPI specifications and Apigee SmartDocs. Publishing API documentation to your portals makes it easy for your developers to learn, test, and evaluate your APIs.

**[Apigee Monetization](https://www.drupal.org/docs/contributed-modules/apigee-monetization)**: 
The Apigee Monetization module lets you integrate a Drupal developer portal with a monetized organization in Apigee Edge, hybrid, or Apigee X.

**[Apigee Developer Portal Kickstart](https://www.drupal.org/docs/contributed-modules/apigee-developer-portal-kickstart)**:
The Apigee Developer Portal Kickstart distribution enables you to quickly evaluate and create a new Apigee developer portal using Drupal.

**References**
- https://www.adaface.com/blog/drupal-interview-questions