---
url: 'https://metadrop.net/en/articles/understand-your-projects-site-structure-and-data-with-xray-audit'
title: "Understand your project's site structure and data with Xray Audit"
author: 'Luis Ruiz'
date: '2023-05-05T10:39:52+00:00'
updated: '2026-06-08T13:58:11+00:00'
type: article
summary: 'At Metadrop, we regularly work on complex projects such as multisites with over 20 sites, numerous contributed and custom-installed modules, various types of profiles, and where Config Split is used for configuration management. Dealing with this complexity can be challenging as it can add a high degree of uncertainty in each phase of the project, and it impacts both the work of developers and those responsible for managing the project (POs, Project Managers, Tech leads). For this reason, we have incorporated into our procedures the regular auditing of the Drupal installations we work on, both for inherited projects and those we start from scratch. In order to automate these audits and make them executable by any profile, we decided to develop the Xray Audit module.'
tags:
  - 'Drupal Planet'
  - Drupal
  - Reports
  - Audit
  - 'Xray Audit (Drupal module)'
  - Entities
  - 'Drupal modules'
  - Contribution
published: true
og:
  determiner: Automatic
  site_name: Metadrop
  'image:alt': "Understand your project's site structure and data with Xray Audit"
  street_address: 'Calle Manuel Luna, 12, 3 Dcha'
  locality: Madrid
  region: Madrid
  postal_code: '28020'
  country_name: España
  email: hola@metadrop.net
  phone_number: '910053180'
schema:
  '@context': 'https://schema.org'
  '@graph':
    -
      '@type': Article
      '@id': 'https://metadrop.net/en/articles/understand-your-projects-site-structure-and-data-with-xray-audit#article'
      name: "Understand your project's site structure and data with Xray Audit"
      headline: "Understand your project's site structure and data with Xray Audit"
      description: |-
        At Metadrop, we regularly work on complex projects such as multisites with over 20 sites, numerous contributed and custom-installed modules, various types of profiles, and where Config Split is used for configuration management. 
        Dealing with this complexity can be challenging as it can add a high degree of uncertainty in each phase of the project, and it impacts both the work of developers and those responsible for managing the project (POs, Project Managers, Tech leads). 
        For this reason, we have incorporated into our procedures the regular auditing of the Drupal installations we work on, both for inherited projects and those we start from scratch. 
        In order to automate these audits and make them executable by any profile, we decided to develop the Xray Audit module.
      about:
        - Drupal
        - Reports
        - Audit
        - 'Xray Audit (Drupal module)'
        - Entities
        - 'Drupal modules'
        - Contribution
      datePublished: '2023-05-11T18:15:52+0200'
      dateModified: '2026-06-08T15:58:11+0200'
      author:
        '@type': Person
        name: 'Luis Ruiz'
      publisher:
        '@type': Organization
        '@id': 'https://metadrop.net/#organization'
      mainEntityOfPage: 'https://metadrop.net/en/articles/understand-your-projects-site-structure-and-data-with-xray-audit'
    -
      '@type': Organization
      '@id': 'https://metadrop.net/#organization'
      url: 'https://metadrop.net/'
      name: Metadrop
      sameAs:
        - 'https://www.drupal.org/metadrop'
        - 'https://twitter.com/metadrop'
        - 'https://asociaciondrupal.es/partner/metadrop'
        - 'https://www.linkedin.com/company/metadrop'
      logo:
        '@type': ImageObject
        url: 'https://metadrop.net/themes/custom/mdrop_radix/logo-metadrop-500-500.jpg'
        width: '500'
        height: '500'
    -
      '@type': ItemPage
      '@id': 'https://metadrop.net/en/articles/understand-your-projects-site-structure-and-data-with-xray-audit'
      breadcrumb:
        '@type': BreadcrumbList
        itemListElement:
          -
            '@type': ListItem
            position: 1
            name: Home
            item: 'https://metadrop.net/en'
          -
            '@type': ListItem
            position: 2
            name: 'Expert Drupal & Tech Articles'
            item: 'https://metadrop.net/en/articles'
      publisher:
        '@type': Organization
        '@id': 'https://metadrop.net/#organization'
---
 1. [Articles](https://metadrop.net/en/articles)
 
  

# Understand your project's site structure and data with Xray Audit

Thursday, May 11, 2023

 

 



At Metadrop, we regularly work on complex projects such as multisites with over 20 sites, numerous contributed and custom-installed modules, various types of profiles, and where Config Split is used for configuration management.

**Dealing with this complexity can be challenging as it can add a **high degree of uncertainty** in each phase of the project, and it impacts both the work of developers and those responsible for managing the project (POs, Project Managers, Tech leads).

For this reason, we have incorporated into our procedures the **regular auditing** of the Drupal installations we work on, both for inherited projects and those we start from scratch.

In order to **automate these audits** and make them executable by any profile, we decided to develop the **Xray Audit module**.



   



## Light on the path 

The main challenge of complex projects is to **calibrate their level of complexity**. Not having the resources to carry out a prior audit can lead to **blind decision-making**. In fact, having **accurate and up-to-date information increases efficiency** both in management and development. Hence, it allows to:

- **Objectively quantifying the complexity** of the project and **properly planning** its execution by establishing the necessary resources and the most suitable strategy.
- Making **informed decisions during development**. For example, in a migration where 20 different paragraphs have been identified, we can know if some of them are hardly being used and are susceptible of being excluded from the migration.
- **Evaluating the** **progress of a project** and detecting in time if it is acquiring excessive complexity.
- Detecting possible **improvements**.
- Additionally, it **facilitates onboarding** for new developers.

So far, the advantages of audits are clear, but at Metadrop we have encountered some difficulties in their execution:

- The need for **technical profiles** to carry out the audit.
- The **investment of time** that these profiles require.
- The **low maintainability and growth of the process**. It is difficult to incorporate new reports into semi-manual audits.

In summary, it is impossible to audit in an **agile way**.

The [Xray Audit](https://www.drupal.org/project/xray_audit "Xray Audit module page") module was created to **overcome** these limitations.

## Xray Audit, or auditing at the click of a button

The Xray Audit module overcomes the drawbacks of semi-manual audits: it allows **instant report** generation by **any profile**, whether developers, project managers or administrators.

In order to facilitate the evolution of the module and simplify the process of implementing new reports, we have developed the module on **Drupal's plugin system**. This way, the developer can focus on the **code** that generates the report rather than on its integration with the module.

At the moment, while we expand the module, let's see the different types of reports that Xray Audit currently offers.

### Content entitiy reports

Since Drupal 8, the[ Entity system](https://www.drupal.org/docs/7/api/entity-api/an-introduction-to-entities "Drupal Entity API") is central, in fact, the community often compares site building through configuration to **playing with LEGO**, where we build an **entity type** (node), which can have different **bundles** (page, article), to which we can **add fields** and configure different **ways to display** the entity (displays).

**What it can be useful for:**

- Calibrate project **complexity** and identify **risks**.
- Know the **number of components** that need to be **refactored**.
- Identify **underused or duplicate** content types that can be eliminated.
- **Detect custom entities** that may not be immediately apparent.

#### Types of content entities

This report shows a list of all existing content entities, including those that belong to **contrib** and **custom** modules.

 

 

#### Entities of content: types and number

They provide information about the **number of entities** existing in the database **grouped by language**. For example, the number of article type nodes that have been created so far.

 

 

**Available reports**

- Number of elements grouped by per type and per type and language 
    - Nodes
    - Paragraphs
    - Taxonomies
- Number of Medias grouped by type
- Users and roles 
    - Number of users per roles
    - Roles
    - Permissions assigned to each role.
    - User activity. It shows the number of users who have accessed in the last 3 months, from 3 to 6 months, and beyond 6 months.

 

 

### Display reports

**What it can be useful for:**

- Establish strategies to **increase performance**.
- **Identification and categorization** of components in refactoring work.
- Understanding **relationships between content entities**.
- Determining the use of **field formatters and image styles**.

#### Displays

These types of reports generate information about the **configuration of displays** for content entities: the **fields** that are shown and the **formatter** applied to each field.

 

 

In this image we see the different displays configured for a type of node called "recipe" (we generated these reports on a Drupal with the installed Umami profile).

- In the first column (fields), all **recipe fields** that exist at the database level are listed, and in the following columns, the **fields configured for each display**, as well as **computed fields**, are shown. These last ones are fields that do not exist as such in the database, but are **calculated "on the fly"**, for example, the links field.
- Media image is a **reference field of entity type**, associated with media entities of type image. In the card display, we can see that it is **configured** to be displayed using the **responsive\_3x2 display**.
- We can consult the **media entity report** to find out how the entity is displayed. On the other hand, in the **teaser display**, which usually shows the basic data of a content, this field is not displayed.

### Report on Drupal modules

This section contains a report on the installed Drupal **modules**, the **projects** they belong to, and whether they are being used, that is, **enabled**.

This is done by reviewing the **exported configuration files**, not exclusively whether they are enabled in the environment and site where we are running the Xray Audit.

This especially interesting in complex projects that use [Configuration Split](https://www.drupal.org/project/config_split "Configuration Split module page") as a tool for managing different configuration contexts. For example, a multisite where there is a config split for each site type (profile), as well as for each environment and site.

The report allows us to know which modules are enabled **globally** (through the `core.extension` file) or those that are enabled by a **specific config split**. For example, in the image, we can see how the Xray Audit module is only enabled in the local environment and not globally.

**What it's useful for**

- Identifying installed modules that can be **removed** because they are not enabled in any context. The "Project" column warns us of those modules that are **submodules** of other modules.
- Detecting **inconsistencies** in config split configuration.
- Of course, knowing which modules are being used at a **glance**.

 

 

## How to extend it

The development of the module has been based on Drupal's **plugin system** to facilitate the integration of new reports. Developers can find **instructions** on how to do this in the README.

`<strong>XrayAuditTaskPlugin</strong>` is the main plugin that will **integrate** the code that generates the report with the module.

```php
/** 
 * 
 * @XrayAuditTaskPlugin ( 
 *   id = "queries_data_media", 
 *   label = @Translation("Data about medias"), 
 *   description = @Translation("Queries execute on database to get reports about medias."), 
 *   group = "queries_data", 
 *   sort = 3, 
 *   operations = { 
 *  	"media_types" = { 
 *      	"label" = "Media types", 
 *      	"description" = "Media types.", 
 *      	"dependencies" = {"media"} 
 *   	}, 
 *	}, 
 *   dependencies = {"media"} 
 * ) 
 */ 
```

**Parameters:**

- **id**: unique identifier.
- **label**: name.
- **description**: a brief description of the reports generated by this plugin.
- **group**: the type of report to which it belongs.
- **sort**: position it occupies on the page where the list of available reports is displayed.
- **operations**: each operation generates a specific report, so a plugin can generate one or several reports. The parameters are: 
    - **index**: unique identifier of the operation. This element is used to construct the URL of the report.
    - **label**: name of the operation.
    - **description**: brief description of the report.
    - **dependencies**: a list of modules that the report depends on. For example, if the report is going to extract data on the Paragraph entity, the Paragraphs module must be enabled. If the dependency is not met, this operation simply is not displayed to the user.
- **dependencies**: it is also possible to define dependencies at the `XrayAuditTaskPlugin` level and not just at the operation level.

Finally, you will need to **override** at least these **two methods**:

- `<strong>getDataResultOperation</strong>`: is responsible for executing the code that returns the data that will be used to generate the report. This data must be returned in an array.
- `<strong>buildDataRenderArray</strong>`: receives the data generated by the previous method and returns a render array.

## Conclusion

Having a radiography of the project you are working on is fundamental during planning and development. But for it to be truly efficient, it must be possible to perform this radiograph at **any point in the project**, by **non-technical profiles**, without requiring additional time investment, and the information must be displayed in a **centralized** manner. With the Xray Audit module, we cover these needs.

At the moment, the module has the reports we have discussed in this article. In the not too distant future, we want to implement the following functionalities:

- Ability to preview the displays of different entities.
- List of blocks (block\_content).
- List and use of Crops and image styles.
- List of active views, displays, and places where they are used.
- List of active modules used for page construction and site navigability, such as Paragraphs, Layout Builder, and Page Manager. The goal would be to quickly identify which site building strategy or strategies are being applied.
- Core status.
- List of active and inactive Webforms and places where they are displayed.

Your suggestions, proposals, and contributions are welcome ;)



[Drupal](https://metadrop.net/en/articles?text=Drupal)

[Reports](https://metadrop.net/en/articles?text=Reports)

[Audit](https://metadrop.net/en/articles?text=Audit)

[Xray Audit (Drupal module)](https://metadrop.net/en/articles?text=Xray%20Audit%20%28Drupal%20module%29)

[Entities](https://metadrop.net/en/articles?text=Entities)

[Drupal modules](https://metadrop.net/en/articles?text=Drupal%20modules)

[Contribution](https://metadrop.net/en/articles?text=Contribution)

 

- Luis Ruiz
    
    Senior Drupal Developer
 
[Drupal Audit Services](https://metadrop.net/en/services/drupal-audit " See Drupal Audit Services")

Independent web audits for accessibility, SEO, performance, security and UX — on Drupal or any platform. Get a prioritised, actionable fix plan with estimated effort.

 

 See more