Questions tagged [entities]

Nodes, comments, taxonomy terms, and users, in the terminology used since Drupal 7, are generally called "entities."

Filter by
Sorted by
Tagged with
1
vote
1answer
529 views

Alter label with token

I am trying to build a questionnaire that simply replaces (alters) the label of a list field. I am doing so by replacing a token from views (embed) and implementing hook_form_alter() in a separate ...
1
vote
1answer
16 views

Enable Layout Builder via code

I would like to programmatically enable the Layout Builder module. I followed the instructions given on Layout Builder — building Drupal 8 layouts, but they don't seem to work. They might be outdated ...
0
votes
0answers
11 views

Add new default value to existing content type

I'm currently on the latest version of Drupal 8. I have a content type called News and Articles. In this content type I have a field called Category which is a taxonomy term -> Entity reference ...
-2
votes
1answer
402 views

Is hook_field_group_build_pre_render_alter() deprecated?

I just came accross hook_field_group_build_pre_render_alter when I was trying to add visibility #state to a field group on the User Regsiter Form (Hide a CCK fieldgroup using #states in ...
0
votes
1answer
47 views

How to get fields definitions of a vocabulary in drupal 8/9? [duplicate]

I needed the field list related a vocabulary item.I was able to list the fields related to a content type by using like this: \Drupal::entityManager()->getFieldDefinitions('node', 'article'); But ...
1
vote
1answer
4k views

Render entity reference field with link in node template

I have a content type with an entity reference field to select a user. Now I would like to render this field in the node template so that the field links to the user profile. I set the format of the ...
0
votes
1answer
429 views

How to get Address Field to display correctly with Autocomplete?

I want to create a postal field for addresses in the Philippines. I have set up a sandbox site with a content type that has just one field, of type addressfield and using the autocomplete widget. ...
0
votes
1answer
16 views

Exract all node field values to json including reference entities with value

I am writing a module to export drupal's content to another platform, the module provides a UI to manage content types and their fields to be shared on another platform via API. So far i have managed ...
-1
votes
2answers
417 views

Search by reference field target ID [closed]

I have a Project content type, which has a reference field to a Contact entity that has a Client bundle. I can get the reference target ID from the node. I want to find the nodes that contain a ...
1
vote
2answers
466 views

How do I use print to generate a PDF of all entities referencing a specific node?

I'm trying to use the Print module to generate pdf's and epubs of the stories on my site. However, I need to get Print to generate these files from the story page and then generate the pdf with ALL ...
0
votes
2answers
386 views

field collection items are not in panels

Im trying to use Panels to display a Field collection but it looks like it is not in the overlay (see screenshot). How can I display the field collection in my panels?
-3
votes
0answers
15 views

Autofill drupal field in edit page

I am not sure if this was posted earlier, but I would be specific and conscise. I am writing a Drupal module to store post meta in the "Node edit" page field. Just basic field, in node edit ...
1
vote
1answer
406 views

How to print the raw value of a custom user field in comments

I want to print a custom user field of the commenters. It is an Link field (https://www.drupal.org/project/link). Some users have that field completed and other not. I've read a lot of posts related ...
0
votes
1answer
506 views

Alter title link in taxonomy view mode

Under /admin/structure/taxonomy/my_vocabulary/display/entity I've got a view mode "entity". For this view mode, I would like to alter the way the link in the title field is built (the title is ...
0
votes
2answers
1k views

How to add a custom field to a taxonomy term

I am developing a module and I would like to know how to add a field to a taxonomy term? My section is named special and I want to add terms in this section I have this code: function add($form,&...
0
votes
1answer
635 views

Get text_long field value with EntityMetadataWrapper

I am trying to get data from a text_long type field using EntityMetadataWrapper, and from what I'm seeing on the interwebs, I should be using something like this: $wrapper->{$field}->value(); ...
3
votes
2answers
2k views

Implementing custom entity forms

In Making use of the admin UI, Step 3 - Implement the entity adding/editing form, it says that you need to implement "a" form with the ENTITY_TYPE_form() signature for add/edit/clone operations... ...
1
vote
1answer
415 views

Display Entity Reference field twice, with different display modes

I have a content type (Type A) that has an Entity Reference field to another content type (Type B). Type B has 3 fields and 2 display modes. Display A shows two of the fields, Display B shows the ...
3
votes
1answer
379 views

Correct way to extended Field Settings

I'm doing something that works fine but I get the feeling there is a better way. I have managed to extend the field settings in the field's manage page to add two new checkboxes. The checkboxes in ...
1
vote
1answer
403 views

Setting up a date field to require an end date

I'm attempting to create a custom content type for a module via hook_install. When I create a date type (from Date module), I want it to require an end date (there's a checkbox when you're setting up ...
0
votes
2answers
114 views

OO way of adding base field definitions

Is there any object oriented Drupal way to add a base field definition to an existing entity? Of course I am familiar with hook_entity_base_field_info(), but I am trying to keep my .module file size ...
0
votes
2answers
358 views

How to show SUM of values from referenced entity fields in a View?

Okay, I've a two content types "A" and "B". "A" is a parent and have a field referenced(Entity Reference) to the child content type "B". Now I've created a View(Table) with a list of "A". And I want ...
1
vote
2answers
494 views

Entity Reference and Views to allow a nested structure

I'm trying to implement a nested structure in such a way as to get a table (within a view?) similar to this: Parent Child Grandchild Age Sex John ...
1
vote
1answer
635 views

Creating Parent-Child Entities

Is there a way to create parent-child entities in Drupal 8? I'm trying to create a structure where the top entity is for County, and the next level entity is for departments, and next level would be ...
0
votes
1answer
648 views

Dynamic Content Type? (field appears based on previous taxonomy choice)

I want to show/hide a field based on a taxonomy choice (in the content admin side of things). Though having this field attached to every item of this content type does add overhead; I suspect it ...
-1
votes
1answer
359 views

How to add a tooltip popup containing social share widgets in a views table

I have a views table containing a number of columns, one contains a small icon. I would like to have a tool tip open (containing the usual share widgets: twitter & facebook) when the image is ...
1
vote
4answers
3k views

Map generated from custom address fields

I have a seemingly simple problem, but I've been stuck with it for some time now. I have a big database of nodes of one content type. There are addresses there made of text fields: one field for ...
1
vote
1answer
2k views

Is it possible to add unlimited values as a group of fields?

Imagine I have a content type that asks you to list your friends. The 2 fields are: | first name | | last name | Is there a way a user could add unlimited friends for both fields (i.e. first ...
2
votes
1answer
491 views

How to display entity label using entity reference field checkbox form display

I am working with Drupal 8. And I want to create a field of entity_reference type. The field has a reference to context_question entity. And the field is displayed fine, but without any description ...
0
votes
1answer
415 views

How do I add fields and hide them from client?

I added fields to a Client profile using Profile2, such as first name and last name. But I added another fields, let's call it "Assigned Consultant". But the "Assigned Consultant" field... I don't ...
3
votes
1answer
590 views

Editing a Field Collection element in a custom module

In a custom module, I'd like to to edit a Field Collection element. The element is linked to a taxonomy but I think the code would look quite similar if it was to a content type. I've read a lot of ...
1
vote
2answers
747 views

Entity form submission sending email

I'm working on entity form using the module "eform" in D8. I would like it to send email when the user submits a form. It was done using some other modules rules and entity rules, but since "entity ...
0
votes
1answer
40 views

How to use “content entity” type in a View?

I have used the "content entity example" coming from the example project. This example module/: defines a "Contact" entity; it can have extra fields, displays can be configured (...
-3
votes
1answer
52 views

Undefined function 'entity_metadata_wrapper'

A custom module is using the following code. function sun_blogs_views_pre_render(&$view) { if ($view->name === 'blog_listing') { if ($view->current_display === 'page') { Drupal::...
3
votes
2answers
6k views

How to render a field collection?

How can I properly render a field collection ? Is there any specific function for that ? I tried field_view_field but it does not output children fields. My field collection is attached to a line ...
1
vote
1answer
463 views

Custom view for Entityform submission

I have a simple Entityform where the user selects from a list of Profile2 user profiles (internal staff and external staff). In simpler terms, the user selects from a list of entities (ie. pick 3 from ...
0
votes
1answer
410 views

Get content types field in another content type with the entity reference relationship

I have two content types. Person and Projects. I use a entity reference for the persons name on the project node so people can select the person that is involved in the project. Now using that ...
1
vote
1answer
381 views

Export translations of field labels

Drupal 7. I work on multi language site. I have a content type with entity translation fields. I've added translation to field labels and settings on my DEV copy of site and now I need to export and ...
5
votes
2answers
2k views

Displaying the contents of a document file (doc, docx, etc.)

I'm looking for a way to display the contents of an uploaded document file such as a .docx file. In Drupal 6 I used the iPaper module which did the trick as all I needed was api code to connect ...
0
votes
2answers
23 views

Entity query on custom entity is not checking access rights

I have a custom entity called project_member. Not all user have access to this entity. But when I query this entity with entityQuery as follows \Drupal::entityQuery('project_member')->execute() all ...
2
votes
2answers
360 views

Hide default value by view mode

I have an image field inside the content type 'Article'. I have two view mode: "teaser" and "full". I have a view page ('Homepage') showing all 'Article' nodes using "teaser" view mode. In the '...
8
votes
4answers
24k views

How to check a boolean value in twig templates?

We have a field_boolean (boolean field) on an ECK Bundle on the article content type. While doing research we came across the question "How to test for a boolean field in a twig template?" but it does ...
0
votes
1answer
360 views

Nodes containing simple field collection not displaying properly

I have a content type to which I added fields like description, image and a field collection containing two simple text fields. Editing and viewing in the backend (logged in as admin) works properly. ...
0
votes
1answer
491 views

Computed field value in twig template

I use a computed field, to calculate and store a floating value for a node. Now I want to work with this value in a twig template. When I access the field value via {{ content.computed_field.0 }}it ...
0
votes
2answers
90 views

Use $base_url in a computed field?

Using $base_url to build a link in a computed field, I get this error: Notice: Undefined variable: base_url in eval() (line 1 of F:\wamp\www\mysite\sites\all\modules\computed_field\computed_field....
3
votes
1answer
2k views

Entity Browser in Forms API

I'm having trouble getting the entity browser widget to work correctly in a custom form. Just wondering if anyone has had any success in getting it working. I've got to the point the button is ...
0
votes
1answer
793 views

searching and entity references

I have two content types documents and authors. When creating a document a selection list of entity reference's to authors is used to select the author. Searches for the author name find the correct ...
0
votes
2answers
390 views

Node value from form state

I have a node which I want to update from a form states values. I can set each value individually like: $node->set("foo", "bar"); Is there a way to mass assign the values instead of setting each ...
1
vote
2answers
401 views

Pass data to hook_entity_insert

How can I pass data to hook_entity_insert() given that the arguments it takes are fixed? I'm writing to the database during entity save, and need to be able to pass some data in this hook.
2
votes
1answer
397 views

Making File Field description required

My users always skip adding the "description" to the file field because they can. I tried implementing the code posted here: How do I make Drupal File Description Field Required? (and thank you) -- ...

1
2 3 4 5
172