Hereβs the solution I usedβI hope it helps!
1. **Update the Component Version**:
First, I updated the component to version `1.0.0-rc5`. Then, to resolve the issue in my custom module, `module_abc`, I applied the approach from [this patch](
https://www.drupal.org/files/issues/2024-07-10/3460633-02-unable-to-find... β
). Following the file structure in this patch, I mirrored the setup used for `component_example`.
2. **Add the `components.yml` Configuration File**:
I created a `components.yml` configuration file for the custom component within `module_abc`. According to the example in the patch, the path should look like this:
```plaintext
/docroot/modules/custom/custom_module_abc/modules/module_abc/components//.component.yml
```
Inside this file, I used content similar to the patch:
```yaml
name: module abc
description: '......'
props:
type: object
properties: {}
```
3. **Create the Required `.twig` Template File**:
In Drupal 10.3 and above, each component also requires a corresponding `.twig` template file. I added this `.twig` file in the same directory as the `.component.yml` file and named it according to the component:
```plaintext
/docroot/modules/custom/custom_module_abc/modules/module_abc/components//.twig
```
Inside the `.twig` file, I included the following basic structure:
```twig
{#
/**
* @file
* Required Twig template for components as of Drupal 10.3.
*/
#}
```
After creating this empty `.twig` file, the error was resolved, and no further code changes were needed. The module is now functioning as expected.
This patch is compatible with both v2.0.2 and v2.0.3.
Upon updating to Drupal 10.2.5, it became evident that the current patch ( https://www.drupal.org/project/drupal/issues/2325899#comment-14900128 π UI fatal caused by views argument handlers no longer can provide their own default argument handling Needs work ) was no longer compatible. In response, I have refined the patch code to ensure its compatibility with the latest Drupal version, 10.2.5. My objective is to make this revised code advantageous for individuals utilizing Drupal 10.2.5 and in need of this particular functionality.
Drupal : 10.2.5
php: 8.2.15
The changes made in Patch #18 & #20 caused an issue where the system attempted to find an entity type called "view_id," which doesn't actually exist in Drupal. This led to an error message: `Drupal\Component\Plugin\Exception\PluginNotFoundException: The "view_id" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition()` when a user accessed the URL `/admin/config/search/redirect`.
The latest patch has fixed these bugs, ensuring that when using the current version of Drupal 9.5 & 10.1.6, this error no longer occurs when accessing the specified URL.
This revised code attempts to utilize entity titles for internal URLs. It checks if the provided entity type exists in Drupal before attempting to load an entity. If an entity is loaded successfully, it checks for translations and retrieves the title or name field. For cases where route parameters are absent, it loads links by route and sets the root menu item's title.
Key modifications:
- Check Entity Type Definition: Before attempting to load an entity, hasDefinition() checks if the provided entity type exists in Drupal. This prevents attempting to load non-existent entity types.
- Entity Loading and Field Handling: After confirming the existence of the entity type, getStorage() is used to retrieve the entity storage handler.