Questions tagged [entities]

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

2,371 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
0answers
2k 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 ...
5
votes
3answers
2k 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 ...
5
votes
2answers
955 views

How to create field collection item fields programmatically?

first of all, English is not my native language so sorry if this reads bad. I'm trying to program a field collection with field collection item fields like the code as given by rbruhn here: https://...
5
votes
2answers
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 ...
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 ...
5
votes
1answer
256 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<-...
4
votes
0answers
97 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 ...
4
votes
1answer
93 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....
4
votes
1answer
58 views

Using entity query build to select entities applying conditions on all revisions

Background Best practice deems that you should use EntityFieldQuery (d7) for making queries that somehow involves fields on entites. An example of such a query could look like this. $query = new ...
4
votes
1answer
1k views

Adding elements to a field widget

What I need to accomplish is adding a link to a node to field widgets (the node contains the formatted instructions to properly compile the field). The goal is something like this: "What is this?" is ...
4
votes
1answer
660 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 ...
4
votes
0answers
82 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 ...
4
votes
1answer
596 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(); $...
4
votes
3answers
958 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 ...
4
votes
2answers
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, ...
4
votes
1answer
187 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 ...
4
votes
1answer
105 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: ...
4
votes
1answer
979 views

Using Entity reference + Views to create members select list

How can I use VIEWS + ENTITY REFERENCE to get list of active members specific to the CURRENT GROUP [created via organic groups]. I have created a view that list active members belonging to the group....
4
votes
3answers
572 views

How do I create an instance of an entity with all its fields attached?

I am trying to create an instance of 'commerce_customer_profile' entity with all the extra fields of the customers address. I am doing this inside a FeedsProcessor that will import users and their ...
3
votes
0answers
130 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 ...
3
votes
1answer
38 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 ...
3
votes
1answer
65 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....
3
votes
0answers
123 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 ...
3
votes
1answer
1k 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 ...
3
votes
0answers
161 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/...
3
votes
0answers
62 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 ...
3
votes
1answer
220 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 ...
3
votes
1answer
79 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 ...
3
votes
0answers
296 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'...
3
votes
2answers
780 views

How do I get JSON data from a custom entity

I would like to GET JSON data from drupal 8 custom entity. I am using ubuntu 14.04 and vagrant. For that i have done these steps. I have taken reference to Create drupal 8 custom entity from this ...
3
votes
1answer
555 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 ...
3
votes
0answers
709 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 ...
3
votes
0answers
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 ...
3
votes
1answer
690 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 "...
3
votes
1answer
92 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. ...
3
votes
0answers
527 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 ...
3
votes
1answer
459 views

How to automatically modify a field after saving content?

I have posted this question on drupal.org (via a comment titled "field modification triggered by saving action"), but I realized that the thread is more than five years old. So I reproduce here the ...
3
votes
1answer
601 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 ...
3
votes
1answer
867 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 ...
3
votes
2answers
517 views

How do I store large volumes or data points using Drupal ( temperature and humidity points )

I'm trying to use Drupal as a headless API, and so far I'm having good results. One of the things I'm collecting is a Temperature and Humidity data. Thus far I've created an entity that can hold the ...
3
votes
2answers
532 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 ...
3
votes
1answer
127 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 ...
3
votes
1answer
1k views

Saving values of a multistep form into custom entity fields

I'm building a module that implement a multistep form based on a custom entity. The entity contains fields which are created by the install file. I was able to create the steps and if I print the $...
3
votes
0answers
73 views

How to reset a Field Collection to its basic, unpopulated state via hook_form_alter()

I am doing a form alter on a node edit form with a Field Collection which may have been previously populated. I want to discard any previous data entered into the fields within the collection so it ...
3
votes
0answers
207 views

How do you add the NID as a view filter criteria and not contextual filter?

I'm using an Entity Reference field, displayed as a View, to select an "Work Entry" node type. The Work Entry nodes are selected when creating/editing an "Invoice" content type. So the user will be ...
3
votes
4answers
3k views

How to use entity form in pop-up window?

I have created a view, and there is one column named "forward to delete". I want to open an entity form in a pop-up after clicking on this link and get the node id of the clicked node so that I can ...
3
votes
2answers
234 views

What to name field collection theme file?

There are several articles here that address theming field collections but none that specifically cover the naming conventions required to actually get them recognized by Drupal. field--field-field-...
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... ...
3
votes
0answers
1k views

Contextual filter based on translated term

I'm looking two days for the right answer but can't find it anywhere. Here is my issue: I'm using Drupal 7.21 with Entity Translation to build a multilangual site (English and Dutch). English is the ...
3
votes
1answer
478 views

Entity Reference to fields

I'm using the Entity Reference module to relate different unique, particular pieces of equipment (identified by unique serial numbers) to different orders. Equipment and orders are content types. On ...

1
2 3 4 5
48