Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [entities]

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

2,363 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
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
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
940 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
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
251 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<-...
5
votes
1answer
186 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 ...
5
votes
3answers
525 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 ...
5
votes
3answers
1k views

How to set a mini panel to display node fields?

I want to load node fields into a mini panel, but when I do what I think that I need to do, the mini panel (= MP) is invisible (because the fields aren't displayed, I guess). So far I have: Added ...
4
votes
0answers
1k 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 ...
4
votes
1answer
81 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
53 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
580 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
78 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 ...
4
votes
1answer
467 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 ...
4
votes
1answer
546 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
930 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
1answer
726 views

Entity Reference field using View to Mask Autocomplete with Last Name

I've posted about this here as well: http://drupal.org/node/1906344 I'm trying to use an Entity Reference field to reference users with a last name field I created on a "Product Page" content type. ...
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
102 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....
3
votes
1answer
37 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
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
132 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
61 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
0answers
114 views

#states in formElement for a FieldWidget

Does #states in formElement doesn’t work the same way it does in buildForm ? I have a field widget where I have a Form for the widget which has a #states in a container. But it’s not working whereas ...
3
votes
1answer
202 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
0answers
66 views

A reliable way to set #required on form fields that are attached to a form via field_attach_form

I need to be able to reliably set #required = TRUE on form fields that are attached via field_attach_form. Some fields might be $form['field_name'][LANGUAGE_NONE]['#required'] = TRUE while others are ...
3
votes
0answers
64 views

Why Each user can modify flag field of other users by VBO(Views Bulk Operation)?

I have many users, and I have a flag and also flag field. users can flag contents and add value in flag field when they are flagging a content. for modifying flag field I'm using VBO Module. But each ...
3
votes
0answers
281 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
734 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
807 views

How to programmatically set the field formatter for a field given certain conditions

I have an entity 'house' with an address field. The address field comes with a default field formatter plugin. This is perfect for when i view my entity at its canonical route and where its view_mode ...
3
votes
0answers
552 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
609 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
1answer
393 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
572 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
818 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
475 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
523 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
117 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
66 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
201 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
231 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... ...