Generate Link based on custom content field types

as flag

I am using Drupal 8.9.8 and I have created a custom content type with field types such as plain text, number (integer), and so on. Then, I created Content based on the custom content types and filled in the field values. This generated a /node/2 page.

I want to combine the field values from the custom content type and generate a URL link that will be displayed in the /node/2.

The generated URL will be in the following format based on the content type field values which are set as default values of the below:

field_url = https:/

field_id = 94ddkf03la1


I have created successfully a module that generates a URL link with .php and .yml accessible from localhost/drupal8/modulename.

I want to accomplish the same functionality, but fetching the values from the custom content type fields.

Where this source code should be placed? Inside modulename.module?

Here is a screenshot of the structure of the custom content type.

enter image description here

I search through the Internet and StackExchange, but I could not figure out or combine the solutions presented.

Please forgive me if the terminology is misleading as I am new to this and I am trying to learn.

ng flag
Where do you want to display this link? Because if it is as part of the content display you can use `hook_entity_view_alter` but if you want be configurable by display you can use extra fields, or maybe you want to use it in views. Depending on the context, the answer can call far from one point to other.
mariosdaskalas avatar
as flag
@d70rr3s I want the link to be generated in /node/2 page. Care to elaborate more on the implementation of this as I am new and still learning. Thanks!
id flag
Drupal 8 reached end of life in November 2021. Even the newest version of 8, which is not 8.9.8, is missing security updates.

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.