Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [entities]

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

1
vote
1answer
51 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
20 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
14 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
15 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
15 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
24 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
18 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
21 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
31 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
30 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
31 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
48 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
31 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 ...
1
vote
1answer
25 views

Related block by entity reference

I have a 2 content types. Article Page and the Article content type can reference pages from an entity reference field. Now I want to display a block on Article nodes that have a same reference. ...
0
votes
1answer
24 views

How to use entity_reference programatically

i'm building a module with an Company entity, this entity should be linked to other 2 entities and i think that the type "entity_reference" should be useful for this pourpose, but i dont see how ...
0
votes
0answers
24 views

Default entities in reference list

I'm implementing a way for providing documents to different users for download on Drupal 8. Each document has a category (implemented as own nodes). Some categories are global. Some categories are ...
0
votes
0answers
15 views

Migration paths for Webforms or Contact Storage modules

Were there ever existed, or is there an existing tradition to create migration paths for Webforms or Contact Storage modules? I ask this because on the one hand I'm not a PHP programmer and on the ...
0
votes
0answers
17 views

ListBuilder changes are not reflecting

I have a NodeEntityListBuilder class with the following in my buildHeader function: public function buildHeader() { $header = array( 'title' => $this->t('Title'), 'type' =&...
1
vote
0answers
35 views

Should I use custom entity types and custom fields to represent complex data types, or is it better to stick with fields and field collections?

Since D7 is now coming up on EOL I need to begin planning the transition of a complex D7 site to D8/9. There are 2 particular data design issues I want to revisit. Number one is that I have a number ...
-1
votes
1answer
81 views

Save contact form data in the database instead of transferring it to an email account

So far I had to setup email DNS records and an email server, or alternatively, an email proxy by an email account) to transfer my emails from a CMS to my email account: 1. Email DNS records and email ...
0
votes
1answer
34 views

Get a list of all entity reference fields that reference specific entity types

Is there a way to get a list of entity reference fields by field type (similar to what is produced by $all_reference_fields = $this->entityFieldManager->getFieldMapByFieldType('entity_reference')...
0
votes
0answers
43 views

Alter field instance settings form on admin/structure/types/manage/<content type>/fields/node.<content type>.<fieldname>/storage

I'm trying to figure out how to add an extra field to content type field settings page. Basically I want to alter field instance settings form on admin/structure/types/manage//fields/node../storage . ...
0
votes
1answer
40 views

Enabling custom content entity module throws error

While enabling my custom module that creates a custom content entity through Drush, I get the following error: [error] Drush command terminated abnormally due to an unrecoverable error. Error: ...
0
votes
0answers
48 views

How do cached discovery definitions affect entity caching?

I'm experiencing an interesting and odd situation with entity (field value) caching. I'm using hook_ENTITY_TYPE_storage_load() to set the value of a field when nodes of a certain type are loaded. Per ...
0
votes
1answer
47 views

Custom content entity route or url alias

I'm not certain if I'm over-complicating something or just missing something or other. Essentially, and in addition to a separate admin view of my custom entities, I want to assign a URL to them at ...
1
vote
3answers
52 views

How to display node title using computed field? [closed]

I have a computed field (text) where I would like to display the node title. I tried the following thing but nothing worked. $value = $entity->title; $entity->title; I referred 1. https://...
0
votes
0answers
29 views

sending a daily digest of content (add, edit, delete) actions by email

I am trying to send a daily digest of all the content entities that have been added, edited or deleted. I am working on Drupal 8 so most of the good modules that achieve that are unstable and ...
0
votes
1answer
37 views

Why doesn't the “Edit” option always appear?

I have a site with several custom entities. For one of the entity types, most objects are fully functional, viewable, usable, but on the entity list page do not offer the Edit option. As my admin ...
1
vote
0answers
30 views

Make EntityQuery Block Table sortable

I made a custom EntityQuery Block Plugin with a table output and managed to make the headers sortable using this $header definition: $header = [ 'title' => [ ...
1
vote
1answer
20 views

Must at least one bundle have the same name as the entity in hook_entity_info()?

I'm working with hook_entity_info, and I'm defining an entity which will have multiple bundles. Do I need to define a bundle which has the same name as the entity, or will the base entity become ...
0
votes
0answers
29 views

How can I preprocess entity references?

I have a module with a custom entity (sample) and a hook_preprocess_sample(). I have another custom entity (retain) that has an entity reference to sample. The preprocess hook looks in the database ...
0
votes
0answers
24 views

How can I display a selected value of a multivalue entity reference field?

I have two content types A and B. There is a multi valued field Persons in content type B. I have created a node of type B and enter two values in Persons field, X and Y. Content type A has an ...
0
votes
0answers
34 views

How do I add a link to a rendered entity?

I have a custom entity, sample. I’ve used the entity display settings interface to set how I want this entity to display on the screen. However, I would like to add a link to another route when it is ...
0
votes
0answers
19 views

adding fields that rely on the definitions of other fields

I'm trying to figure out if there is a way to add base or bundle fields across all entity types, in a way that relies on the definitions of other fields. Here is my use case: Suppose we have a ...
0
votes
0answers
33 views

How to get referencing parent entity when adding entities via Inline Entity Form to set automatic titles?

I have a content type "Parent" and a content type "Child". When adding Parents, the user can add Childs via Inline Entity Form. Child content types have Automatic Entity Label enabled. In that ...
1
vote
0answers
20 views

entity_autocomplete for custom entity

There is the entity_autocomplete field type which I expect should just work for core entities. I have created my own entity using Drupal console and would like to query those entities with an ...
0
votes
1answer
21 views

How to save data in entity form?

I have created one entity form using Entityform module and Entity type is clients. Created 3 fields below. Name - (type: text) Email - (type: Email) Logo - (type: Image) Now I want to save data ...
0
votes
1answer
45 views

Creating a node via REST - Entity reference field value not updating

I'm trying to create a node on a Drupal 8 site via REST. Passing all the values to create the fields work fine apart from the field that is an entity reference field. The field is an entity reference ...
1
vote
0answers
52 views

Custom template not used for custom entity generated with Drupal Console [closed]

I have created a custom entity via drupal console, and it created template item_entity.html.twig in template folder, but the entity is being rendered in some other way because any changes in template ...
0
votes
0answers
15 views

Entity Refernce View Widget conflicting with Time Field?

am trying to setup a content type that has the need for both an Entity Reference Views Widget and also needs fields using Time Field (https://www.drupal.org/project/timefield), however the ERVW does ...
1
vote
1answer
44 views

How to create entity relation of counselor to client?

I'm trying to create a relation in D8 between a counselor and clients. The counselor would have to record counseling hours for each client. I've looked at the group module, even building the ...
0
votes
2answers
44 views

How to insert fields into a link field in twig?

We have several fields on our Article content type, one of which is a Link field. In a twig template we would like to display a <section> such that all of it is clickable with different fields ...
0
votes
0answers
33 views

Paragraph field titles showing even when set to visually hidden

I am using the following code to render a paragraph entity in a twig template: {{ content.entity_name}} A second template renders the paragraph's fields correctly using: <h2>{{ content....
0
votes
0answers
110 views

Export custom content type with fields

I want to export a newly created content type which has bunch of fields to a new application installation. Also I need to export few views etc... Exercise: I created a sandbox drupal 8 application. ...
0
votes
0answers
28 views

Pagination with entity

Don't know where to start and not sure if there is already some builtin functionality that can be used. I have an entity and items on the page are rendered with class ItemEntityListBuilder how can I ...
1
vote
1answer
137 views

When adding media to content, how can I search for the media by tag or term?

In Drupal 8, I created a new Media type "PDF Files." I have imported almost 30,000 of them, each complete with Title (Name), file, and the taxonomy that categorizes them. On the content type (Let's ...
0
votes
2answers
33 views

Set value of file field using entity_metadata_wrapper non working

I have a custom entity with a file field accepting multiple values. I would like to set file values according to https://www.drupal.org/docs/7/api/entity-api/entity-metadata-wrappers#example-value-set-...
0
votes
1answer
19 views

Digit 2 Appended to Field Name on Column in Entity Field Query

I have an Entity Field Query that has fieldCondition for field_email ->fieldCondition('field_email', 'value', $email , '='); I have verified that this is the name of the field and I have other ...
1
vote
1answer
25 views

Viewing an image file breaks if view mode has responsive image style

I have an image file that I am viewing programmatically. When I set the image format to "responsive image" in file display settings, it breaks with an error Error: Call to a member function ...
2
votes
3answers
97 views

how to get all the fields that have been modified on entity save (form submit)?

I am trying to figure out an efficient way to get the fields names/values that have been updated. It's kind of similar to what the diff module does to calculate changed on a node but not as detailed. ...