Skip to main content

Questions tagged [entities]

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

2,349 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
8 votes
2 answers
3k views

Add Expression for Entity Query

I've been working with the entityQuery to query the db and get an array of filtered nids however I need to add an expression to my query. I've checked the Query class and found a protected sqlQuery ...
113408's user avatar
  • 326
7 votes
1 answer
308 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 ...
Alex's user avatar
  • 2,523
6 votes
0 answers
488 views

How best to determine what differs between field schema and field definitions when "Mismatched entity and/or field definitions" is reported?

I've inherited a large, enterprise Drupal 8 site in which we have many "Mismatched entity and/or field definitions" warnings reported in the status report. The site is currently running on ...
Spartanicus's user avatar
6 votes
1 answer
160 views

Benefit of config entities over regular config entries?

In Drupal 8 it is possible to store configuration in "config entities". However, the same can also be achieved with non-entity config entries. E.g. one example for a config entity schema, from core....
donquixote's user avatar
  • 3,652
6 votes
0 answers
116 views

How to modify auto populate field value?

I m Stuck in two situation where I have to modify value of one field depending on another field selection. First situation is like I have two field Region (Node reference) - the widget type is ...
Sudha Bisht's user avatar
6 votes
3 answers
3k views

How do I define a computed field equal to the concatenation of two fields of my custom entity?

I have a custom entity (Person) with these fields: ID, nom, prenom, telephoneportable, estactive, userID, created, changed. I created it with baseFieldDefinitions. I want to have a computed field ...
gbmapo's user avatar
  • 1,086
5 votes
0 answers
333 views

Add third party settings to a basefield definition

Is there a way to add third party settings when defining a basefield for a custom Content Entity? I am creating a new Entity type and want to keep the fields defined in code vs config as much as I can....
Jimmyb_1991's user avatar
5 votes
0 answers
589 views

How to add translation to Inline Entity Form + Entity Browser

Situation I've got a special "Dashboard" node that consists of entity references to other node types. In dashboard form mode all widgets are configured to use Entity Browser to display an (Inline ...
Hudri's user avatar
  • 5,535
5 votes
2 answers
995 views

How to create field collection item fields programmatically?

I'm trying to program a field collection with field collection item fields like the code as given by rbruhn on Creating field collection programatically. I want to create it on an easier level for ...
Thomas's user avatar
  • 59
5 votes
2 answers
3k views

Save data to custom field columns using entity_metadata_wrapper

I have a simple custom module that creates a new field type. The field has multiple columns in the database; the idea is that a user (or code) will enter a single value, and then that value is ...
ouni's user avatar
  • 503
5 votes
2 answers
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 ...
droopie's user avatar
  • 105
5 votes
1 answer
272 views

Make variables outside of node available to pathauto

I'm trying to port a website over to Drupal 7. The structure consists of locations which have an entity reference to a region which has an entity reference to a country: location<-region<-...
Chris Leather's user avatar
4 votes
0 answers
372 views

Is ContentEntityBase::access affected by hook_ENTITY_TYPE_access?

Are calls to the access() method on entity objects which is provided by ContentEntityBase affected by hook_ENTITY_TYPE_access()? I am asking because the Paragraphs module, in src/...
ummdorian's user avatar
  • 527
4 votes
1 answer
990 views

How to fix "Unable to save a field collection item without a valid reference to a host entity" error?

I programmatically created a series of custom content entities which contain field collections. My site had an execution timeout error in the middle of entity creation and saving. I can not delete ...
saramm1's user avatar
  • 727
4 votes
0 answers
430 views

How to create additional base fields for ECK entity

For example I want to create a Vehicle ECK base type and Car and Truck bundles, but I want to define fields for the Vehicle base type that would be shared between Car and Truck. In UI, by default, I'...
Trupal's user avatar
  • 513
4 votes
1 answer
694 views

EntityFieldQuery with Workflow

I need to filter an EntityFieldQuery with a given workflow state, let's say workflow it is state 21 (sid = 21). Below, the query I am using $query_formularios_completos = new EntityFieldQuery(); $...
Marcos Buarque's user avatar
4 votes
3 answers
1k views

Get field_collection values in field template

I have installed field_collection and have a collection called field_contact, each entry of which has a field called field_contact_url I'm trying to customise the display of that field by overriding ...
ChrisJ's user avatar
  • 203
4 votes
2 answers
1k views

Upload file and fill in fields in one step; or trigger a rule when a file is uploaded

I want to make use of the Media module and the File entity module to upload files, in particular images, to my site without having to attach them to a node. Solely uploading images works like a charm, ...
deinqwertz's user avatar
4 votes
1 answer
188 views

Node reference solution for a content type which referenced to two fields. (company, product & review)

My website has three content types: company, product & review. 1). The product has a field referenced to a company node using Node URL Reference module. 2). The review has two fields, one ...
user7532's user avatar
4 votes
1 answer
106 views

How to set up a question/assignment pool for a course website?

I have done quite a bit of Drupal work in the past, but am a bit stuck on this one. The basic idea is that the site will offer 1-on-1 tutoring to students. There will be there levels of users: ...
MarkD's user avatar
  • 195
3 votes
0 answers
216 views

How to properly extend Entity Query class?

I am working on some complex aggregate reporting that pulls from several sources (node type) and generates a report in a table display. There are about 10ish line items (could be more later) and ...
Kevin's user avatar
  • 27.9k
3 votes
1 answer
248 views

Pass arguments to the entity_browser iframe url (modal)

I have a form I have a field of type Date Range, I also have another field of type entity_browser(modal) with a selection view widget. The normal behavior when I click the Button of the entity browser ...
chalo's user avatar
  • 431
3 votes
0 answers
363 views

Custom compound field with 2 entity_reference fields

I'm trying to create a custom compound field in D8 that, among others, includes an entity_reference to a node and an entity_reference to a taxonomy term. I did follow the answer from this question. ...
theuni's user avatar
  • 865
3 votes
0 answers
791 views

Change field type for custom entity (from integer to decimal) with existing data

Yes I have seen previous answers about that, but I'm looking for an new answer : That does not use SQL request That does not use deprecated function like db_change_field() maybe that uses the new ...
Simon's user avatar
  • 131
3 votes
0 answers
430 views

How can I attach a paragraph to a node using hook_node_update()?

I am trying to attach a paragraph whose value comes from a custom field to a node, in hook_node_update(). I tried with two different implementations. Neither of those work. function ...
Rupali Patidar's user avatar
3 votes
1 answer
120 views

How to load an entity definition?

I need to load an entity definition to add a constraint and test it, I found that this is possible with the following code: $manager = \Drupal::entityDefinitionUpdateManager(); $entity_definition = $...
Adrian Cid Almaguer's user avatar
3 votes
0 answers
1k views

Entity query - using parent/grandparent ids as a condition

I have relationships linking a node to a child paragraph, with a grandchild paragraph: Node |_ paragraph child |_ paragraph grandchild Using an entityQuery, I can get child items using ...
mediaashley's user avatar
  • 1,104
3 votes
1 answer
46 views

Create an Entity (Beginner)

beginner here, I am trying to follow the typical entity example and create my own entity in Drupal 7. So I basically changed the name from typical_entity_example_1 to source_entity and the test fails ...
theG's user avatar
  • 31
3 votes
1 answer
68 views

How do I examine an entity's update SQL statement in order to write a unit test?

I have a core patch (https://www.drupal.org/node/2342699) which ensures that SQL updates do not include the primary key in the field list. I need to write a unit test for this issue and EntityApiTest....
Kevin Nowaczyk's user avatar
3 votes
0 answers
146 views

Template name suggestion for multivalue image field in paragraph module?

How can I create a dedicated template name suggestion for paragraphs multi value image field? The below HTML comments are the theme hook suggestions added by the debug function, for the paragraph ...
Mojtaba Reyhani's user avatar
3 votes
0 answers
843 views

Custom field does not save data in db

I created a custom field because i wanted to store a multiple field with: social type (Facebook, Twitter, etc..) social ID Everything shows fine, but when I save some data, nothing is saved and no ...
Piero's user avatar
  • 141
3 votes
1 answer
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 ...
phob0s_'s user avatar
  • 31
3 votes
0 answers
67 views

How do I get back JSON value using entityform?

I am using drupal 7 entityform in this case, as i want CRUD functionality with the form. Can anyone tell me how should i configure my services. As of now i have configured it manually, selected the ...
Anirban Neogi's user avatar
3 votes
1 answer
267 views

How to make custom entity type revisionable with existing content?

I'm trying to make a custom entity (with existing data!) revisionable, but I run into multiple very serious issues including schema update errors, difficulties with creating revision data for existing ...
Ken Trash's user avatar
3 votes
1 answer
89 views

Customizing the display of properties on a rendered entity

I have a custom entity with a large amount of properties on it. We want to format these entity properties to look a certain way, without modifying the underlying data in the table. What is the most ...
Jack Ryan's user avatar
  • 2,307
3 votes
1 answer
756 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 ...
Jonathan Bergeron's user avatar
3 votes
0 answers
1k views

Drupal 8: set (sub) fields of the address field optional (not required)

I need an address field that allow the user to encode only a country OR a country with some other fields he could choose freely. I other words, I need an address field without any required field. To ...
Baud's user avatar
  • 542
3 votes
0 answers
1k views

How set default value for entity reference field

I want set a default value for my entity field reference refer to his parent. I am on his parent and with a link i load a popup with the form of the child : My parent is in the URL param value 2 for ...
Kevin's user avatar
  • 2,566
3 votes
1 answer
894 views

How to add a class to the <a> link elements within a Multiple Values field in a View?

I have a Views field (in this case, taxonomy term references) with Multiple Values set to "Display all values in the same row", using the Link formatter and a seperator. I want to add a class to each "...
user56reinstatemonica8's user avatar
3 votes
1 answer
104 views

How do I edit the output of a field?

I am creating REST API using Services Module in Drupal 7. I have created a View to Get lists of Groups. In this views, I have added a Field privacy which will tell if the group is Private or Public. ...
Malik's user avatar
  • 157
3 votes
0 answers
626 views

How to export entity instances created with ECK?

I have created my custom entity types (and bundles) using ECK module. Is it possible to export entities from website, for example using Features? I have found this thread but as I understand, it is ...
tomas.teicher's user avatar
3 votes
2 answers
3k views

How to add UniqueField constraint on integer field?

The title basically says it all. I have the following field definition in an Entity class: $fields['code'] = BaseFieldDefinition::create('integer') ->setLabel(t('unique code')) -&...
Jens Wegar's user avatar
3 votes
0 answers
603 views

Split multi-value field across columns in table View?

I have a Taxonomy with a geographical hierarchy (Region > Province > City > District), which I'm adding to nodes using the Hierarchical Select module. Because I set the field to "store the full ...
Martin K's user avatar
  • 565
3 votes
2 answers
800 views

Webform description allowing HTML

I'd like to allow HTML in my webform field descriptions. I don't need an editor of some sorts; just the basics like and tags and stuff. How can I edit my webform to allow these tags in the ...
CaptainCarl's user avatar
3 votes
1 answer
2k views

Changing decimal field scale and precision using database

I'm using a custom decimal field in a custom product type in Drupal commerce. It has a precision of 10 and a scale of 2 (2 digits to the right of the decimal place). I have a client with a large ...
Scott Lawrence's user avatar
3 votes
1 answer
1k views

Entity Translation for custom entity

I've created a custom entity and in the next step, I would like to use the Entity Translation module to make the entity translatable. My entity is defined like this /** * Implements ...
moertle's user avatar
  • 188
3 votes
1 answer
707 views

Accessing content for a specific node revision via a relationship in Views

A module I've written implements hooks defined by the Field API to provide a custom field for defining references to specific node revisions by storing vids. (The module borrows functionality from the ...
Matt Elkins's user avatar
3 votes
2 answers
670 views

Strip HTML tags from Field Collections in Services Views

I'm trying to strip the HTML tags from a JSON response I generated using Services Views, but I'm not having any luck so far. I have a content type with a Field Collections field in it that is ...
Sander van't Veer's user avatar
3 votes
1 answer
162 views

is there a module for instagram like YouTube Field?

I need a module that permit to my editor user to choice photo from instagram and linked them in a field of a content type. I have found https://www.drupal.org/project/instagram_feeds but I don't ...
ZioBudda's user avatar
  • 1,182
3 votes
2 answers
1k views

Inline entity form shows a content type select list

I am using Inline entity form for a non-commerce project. The settings are:Widget:multiple values,Node:Allow users to add existing content. Mode:Views:Filter by Entity reference view.So I have created ...
Dion's user avatar
  • 2,398

1
2 3 4 5
47