Report about usage of entity bundles (paragraph, nodes)

Created on 17 July 2023, 12 months ago
Updated 3 August 2023, 11 months ago

Problem/Motivation

In complex Drupal installations, it is difficult to determine the usage of content and paragraphs, detect those that are not being used and detect those that are not being used and therefore may be susceptible to being deleted.

It would be very useful if this report could be launched from a drush command.

Proposed resolution

First, let's define what we mean by the usage of an entity based on the entity type:

Node: In this case, we distinguish finally in one type of usage: Status is Published

Paragraph: In the case of paragraphs, the usage will be understood as being referenced since a paragraph cannot exist independently. Initially, we should focus on the first-level relationship, that is, node -> paragraph, or any other type of entity.

Then the report should display both the number of usages and references to the locations where they are used.

API changes

It would be necessary to implement the integration of drush commands in the plugins.

New features

The new functionalities implemented:

Three services have been created:

  • "xray_audit:entity_use_place" (to get the places where an node bundle or paragraph bundle is used)
  • "xray_audit:node_count" (to get the number of times an node bundle is used)
  • "xray_audit:paragraph_count" (to get the number of times an paragraph bundle is used)

In both cases (node and paragraph), you can set the bundle or bundles you want to analyze. If they are not set, all the configured bundles in the fields of the entity are analyzed.

We have added the 'operation' and a link in the paragraph inheritance table so that from there, you can view a list of the parents referenced by that bundle.

Feature request
Status

Fixed

Version

1.4

Component

Code

Created by

🇪🇸Spain lpeidro Madrid

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024