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
0
votes
0answers
11 views

How to compute field value of another content type using compute field module?

I have two content types. Let's call them "A" and "B". A has nodes with field_cost B has nodes with field_total_cost Content type A has a field_costumer which is referenced to the entity of Content ...
1
vote
1answer
20 views

Refreshing entity definition

I've got a D8 media type that holds information obtained from an external source. The information comes in name value pairs that I wish to save as individual fields, mostly so I can index them easily ...
-1
votes
2answers
154 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 ...
0
votes
0answers
23 views

I accidentally deleted basic_cart_vat, there's a way to a restore this field?

I accidentally deleted the field basic_cart_vat from Orders, now I'm receiving an error because I don't have the field. InvalidArgumentException: Field basic_cart_vat is unknown. in Drupal\Core\...
0
votes
2answers
27 views

Create a view on a entity using criteria on another entity

I'm trying to this done : I have two entities 1) Listing Details 2) Listing Premium Settings. This entity references the first Listing Details entity. In the second Entity I have referenced entity ...
0
votes
1answer
143 views

How can I get all fields and values of a node at once?

I know how to get a particular field (title field) of a node by following code: $publications = \Drupal::entityManager()->getStorage('node')->load($node_id); $title = $publications->getTitle(...
1
vote
1answer
1k views

Running drush entity:updates claimed successful but not changing anything

I am working on a project with custom entity type. My module works fine in my local environment. But when I deployed to my staging site, things are strange. For instance, I tried to change my entity ...
-3
votes
1answer
151 views

Getting an error while updating core to version 8.7.0

When update Drupal 8.6 to 8.7 getting the following error. Anyone help would be appreciated. TypeError: Argument 3 passed to Drupal\views\EntityViewsData::mapFieldDefinition() must implement ...
0
votes
0answers
30 views

Data storage for custom config-entity sequence type

Using Drupal 8 I've got a custom content type application and a ConfigEntityType application_type for bundles of it. I need each bundle to store a list of strings when newly created/edited. E.g. ...
0
votes
1answer
37 views

How do I know what setSetting is suppose to be?

I am creating a custom content entity and in the BaseFieldDefinitions, I am trying to create a field for assigning a user as the designated assigner and will follow up with a assignee. So far, the ...
0
votes
0answers
31 views

How to handle submit of a form that extends RegisterForm?

I have a form that extends the native RegisterForm When this form is submitted, I would like to register a user, but then I would also like to store the uuid & certain fields like name & ...
0
votes
1answer
30 views

How do you populate existing entities with the default value for a newly added field?

Let's say I have a content type, Article, with several fields. I already have hundreds of Article nodes created, but now I want to add a new field. After I set a default value for this field, how can ...
2
votes
1answer
27 views

Is there a generic method to retrieve entity IDs?

I have seen this code suggesting how to return a list of entity IDs: $query = \Drupal::entityQuery('node'); $query->condition('type', $bundle); $entity_ids = $query->execute(); but this ...
0
votes
0answers
20 views

Programmatically add field collection item (child) into a existing field collection item (parent)

I have a nested field collection item, field_collection_parent which contains one field_text and a field collection field_collection_child contains two text fields(field_a and field_b). Now I'm ...
0
votes
0answers
25 views

Use autocomplete with an infinite cardinality

I am trying to attach a list of users to a new entity I am creating. I want to enable autocomplete on those fields but I can't get it to work. For the moment, my field looks like this : array( ...
0
votes
1answer
288 views

Display multi-value entity reference field in node edit form as draggable?

Is there a way to display a multi-value entity reference field as a draggable widget in a node edit form? I'm looking for the exact same behavior that a multi-value image field has by default. I would ...
0
votes
0answers
159 views

Updating a module results in a Mismatched entity and/or field definitions with live server only

Installing updates produces Mismatched entity and/or field definitions, yet only within the live server instance. Local environment works as expected. It first happened with the update 8001 in both ...
0
votes
0answers
20 views

no default store (drupal commerce 1.x)

Is there a way to adjust or add the "default store" value directly in a SQL table? I have no default store listed - if it is applicable to version 1.x and all the products I imported from Ubercart ...
0
votes
0answers
41 views

How to install the module Entity Browser?

I'm trying to install the Entity Browser module, but I'm getting this error: It basically says that the "entity_browser" entity type does not exist, and based on the error I tried to install the ...
0
votes
0answers
55 views

How can I replace static file and media links in content with their equivalent entity references?

I imported content from another system. So, for example, the body has typical html, like this: <img src="/images/image.jpg /> All of the media assets that are referenced as static html, those ...
0
votes
1answer
45 views

Referenced entities show old value when changing properties

I have three custom entities, all generated with Drupal Console. I only added some basicFieldDefinitions to them before testing some CRUD operations on them. I have these entities: ConfigEntity (...
0
votes
1answer
39 views

How Can I do a content type with a 1:n field inside?

I'm a bit lost about how Drupal manage content. For example, I want to create a new content type called Game. When I create a "Game" I want to introduce "Platform" and "Release date". For example: ...
1
vote
1answer
74 views

Why is file_managed not updated correctly?

In a custom module (amap), I have a custom content entity (contract) created with Drupal Console. There are standard CRUD functions on this entity. One of the fields of the entity is a file field: $...
0
votes
1answer
35 views

Adding fields to user registration form for admins

I use the Entity Registration module and I created a registration form for specific events in a Drupal 7 site. For the registered users, the fields are name, surname, birth date, upload administrative ...
0
votes
1answer
52 views

How do I get the weight of a multiple value field collection in a computed field?

I have the following structure in a content type: . field_collection_parent (multiple value = 7) .. computed field (single value) .. field_collection_child (unlimited multiple value) ...
1
vote
1answer
211 views

How to get a field third party settings for every content entity forms

Can someone explain or post an example of how to get a third party field settings on every content entity forms? I'm looking for a generic code where a form can be customized (like calling a custom ...
0
votes
0answers
26 views

Default value for image field not accessible [duplicate]

I have added a field to content types so that users can upload a custom background image based on content type. This is a Drupal 8 site. The field is set as required and has a default image uploaded ...
0
votes
0answers
52 views

Error when removing fields from entity

For any reason I receive this ugly message every time when removing a field from an entity. No matter if the entity is a node or a paragraph. The error message makes no sense, as removing a field ...
0
votes
0answers
34 views

Efficient way to get entity information

Which is an efficient way to fetch entity label and id? Database query or entity query with entity load? I need to get the list of all taxonomy terms in an associative array of ID and Label. I can ...
0
votes
0answers
20 views

How to pick up node context in a block to prepopulate entity references in node add link

Let's say I'm building a genealogy site, where I'm displaying an Individual (node 15), that belongs to an Organic Group instantiated as "My Family Album" (node 8). I want to have a side panel block, ...
0
votes
1answer
193 views

Change target type of entity reference field in update hook

In an update function, I'm trying to change the target_type of an entity reference field, following the approach outlined on https://www.drupal.org/node/2535476). The previously used target entity ...
2
votes
1answer
86 views

How can I add entity base field with unique constraint if some entities already exist?

The issue is that adding a base field to a custom entity type in code would result in an issue of unique constraint violation as there does not seem to be a way to preset the value to the newly added ...
0
votes
1answer
94 views

Add preview button on Taxonomy add/edit term form

As we know that entity type node has preview button option which can be used during adding or editing of a node, to preview content. Same feature is missing in case of Taxonomy entity. If I want ...
1
vote
0answers
24 views

Custom Content Entity Type: links annotation

I created a Custom Content Entity Type with all the basic CRUD operations. It is working but I do not understand how the links work in the entity annotation and therefore not why they are necessary. ...
0
votes
0answers
109 views

Use a custom Table/Storage for a Custom Field

I want to create a DR8 content field, which has no field tables, and passes the save and load mechanisms to a custom table. Is there a way to do this? I've been able to prevent saving with: class ...
1
vote
0answers
34 views

EntityFieldQuery: Filter by field language

How would I use EntityFieldQuery->fieldCondition() or similar to filter by field language? E.g. give me all nodes where field_description has items in English, or in LANGUAGE_NONE? There is a $...
0
votes
2answers
98 views

Update node revision time in hook_entity_presave

In my site Drupal 8, I have custom entities (say components) and bundles. I load these entities in a node using the Inline entity module. On the front-end, the contextual links provide two edit links: ...
4
votes
2answers
279 views

Bidirectional entity relationships?

I am doing a migration right now and have a need to maintain how entities are related in a way that the core entity reference field does not seem to support. Lets say I have two content types, Foo ...
0
votes
1answer
30 views

How do I retrieve media from a reference field?

Inside a node type, I have a reference field to target a media. With a db select, I need to load all related medias of the nodes. For this I use this code: $database = \Drupal::database(); $result = ...
0
votes
0answers
72 views

How to programmatically add fields to a node through a module

I've followed a tutorial here about adding a field to every taxonomy and node and I'm getting an error on installing it. I can get the field, widget and formatter to work, just can't get it to install....
0
votes
0answers
32 views

Get the field for a value of a “List (integer)” field using entity_load()

I am trying to get the label for a value of a List (integer) field using entity_load(). With the code I am using, I'm able to get the field key with $flagging->field_form_status['und'][0]['value'],...
0
votes
1answer
440 views

Get Entity ID when is saved

I need to capture the entity_id when the entity is saved. The ID will process and insert in a custom field. I use hook_entity_presave(), but when is a new entity the ID is void. Is there any way to ...
0
votes
1answer
63 views

Custom Entity Type and Bundle Creation

I've been building custom entities for a while now, but have been using the entity construction kit (eck) to build them. This has limitations as it requires you to #1 depend on the package for new ...
-2
votes
1answer
50 views

How can I import a CSV file to custom entity created using ECK module?

I have created a custom entity type using ECK module. I want to import a csv file with data to my custom entity. How do I do this?
0
votes
0answers
44 views

Datetime wrong type in database

i'm triying to create an custom entity, to store data i'm creating a schema through BaseFieldDefinition (or some near). The problem is that some fiels of type datetime are created in the database with ...
0
votes
2answers
77 views

How can I see all the places an asset or entity is referenced?

In Drupal 8, I have a requirement from a client that they be able to find a reference of a given asset (file, node, entity, etc) throughout a Drupal site. The ultimate goal is to know that if they ...
0
votes
1answer
34 views

How do I add a customized parameter to image links

Lets say I have image fields in my node. When I get that fields values in the twig it returns the image URL without any issue. file_url(node.field_image.entity.uri.value) But now I want to add a ...
0
votes
2answers
37 views

How to print an entity bundle field from one with multiple values

Struggling to find the answer to this. I have an entity called "school objects" which has a bundle called "homepage". One of the fields attached to this is called "Hero banners" and it allows multiple ...
1
vote
0answers
177 views

How a media image entity_reference field in a custom content entity can be set to translatable?

I created a media image field in my custom entity content: $fields['image'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Promotion image')) ->setDescription(t('...
0
votes
0answers
186 views

Paragraph containing an entity reference field as a select - Show options by something other than label

I have an author content type. I have a book content type. I associate multiple books with an author by having a books paragraph field in the Author create / edit form. In my Book Paragraph field I ...