We’re rewarding the question askers & reputations are being recalculated! Read more.

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
1answer
707 views

Add classes to programmatically added fields

I have programmatically created a few content types and fields for said content types in a module I'm building, but I need to add classes to said fields. So if I have a text field called "...
1
vote
1answer
694 views

How can I make a template for a product type in Commerce?

I want to be able to write my own markup for the fields (see image below) of each product type – how do I do this? My main reason for this is that I want to group them with my own HTML rather than the ...
1
vote
3answers
1k views

How do I perform outstanding entity updates after 8.7?

I have just tested the update to 8.7.1 (from 8.6.x) which includes the removal of the old automatic entity update functionality, which means drush entup no longer works. As far as I understand the ...
1
vote
3answers
1k views

How do I update a user profile with entity_metadata_wrapper()?

I got an error while updating user profile data such as name,password and email. I am using entity_metadata_wrapper() for processing update. exception 'EntityMetadataWrapperException' with message '...
0
votes
0answers
13 views

Items removed from Node Reference field are still displaying on the node

This problem only very recently cropped up; I've never encountered it before. I have a content type (Resource) that contains a Node Reference field (pointing to Organization nodes) that allows ...
1
vote
1answer
2k views

How to print the file description to my twig template?

I'm trying to figure how I can obtain or print the file description that is uploaded on my node and display on my twig template So far I have tried {{ file.entity.label }} which only prints the name ...
1
vote
1answer
567 views

How to create a confirm popup when delete item with field collection?

I have configured a field collection field (unlimited items) for a content type and I want create a confirm popup when user delete an item. For this, i found that i can directly go and modify 2 ...
0
votes
1answer
365 views

“Image Upload Button” section remove after click on upload

I am trying to edit users's profile page in Drupal 7. I have an image upload button there, but it remove (hide) after click on upload button . But If i login with admin its working fine, means image ...
0
votes
1answer
97 views

Where 'target_id' of field_data_field… tables points?

I'm extracting database information from a Drupal site that I have using SQL queries. I have seen that, in the field_data_field... tables can be three type of information storage: field...value: ...
0
votes
0answers
21 views

Revisions Tab is not visible

I updated Drupal to 8.6.16 version and after that Revisions Tab is disappeared. Actually, all revisions are saved fine and I can see them because I have access to the page "xxx/revisions", but I don't ...
0
votes
1answer
566 views

How to show an Inline Entity Form on a PM page or panel?

I'm trying to include an Inline Entity Form on a panels display (via ctools Page Manager). The Inline Entity Form field is attached to users, and the page in question has the user's context. The ...
0
votes
1answer
599 views

Getting a custom field to appear correctly in Rules using entity form module

I have written a custom field widget called foo which is inserted into an entity form to provide an autocomplete to another web service. I am trying to get the field data to be sent in an email via ...
9
votes
1answer
4k views

Load a file entity by URI

Is there a way to load a file by URI in Drupal 8? In Drupal 7 it is possible by the next example: $uri = 'public://file.xyz'; // Take a look at: file.inc::file_load_multiple $files = ...
4
votes
2answers
6k views

How can I load a File entity?

I want to find out whether a physical file is managed by Drupal and if it is, then load it. I'm having trouble with the documentation which keeps displaying "File not found" at crucial moments, but ...
1
vote
2answers
634 views

Hide Alt and Title for image field

How to hide Alt and Title fields for anonymus users when they upload images? I use tokens for these field that's why I need to hide them.
1
vote
0answers
14 views

How to mark related entities as dirty in search api module when edited?

I am using Drupal 7 with the search api. I understand that one of the 'common pitfalls' of the search api is 'Changes in related entities don't lead to re-indexing'. I am bringing in a field called '...
0
votes
0answers
12 views

Entity Translate won't show translations on template overrides

I have set up entity translate and it lets me add the translations so they are stored in the DB. But when I click on the translated page, all I see is the orginal language which is English. So I these ...
0
votes
1answer
58 views

Custom remote video thumbnail

I'm using the media entity from Drupal core together with the media library, to handle media on my site. I have Remote Video and Image with crop media types. I'm using the crop and image_widget_crop ...
0
votes
1answer
28 views

Entity Validation API: Retrieve parent field entity while validating

I'm using the Drupal 8 Entity Validation API. I've implemented my Constraint and ConstraintValidator classes and added them as a constraint against the relevant entity field. If I understand the ...
2
votes
1answer
1k views

Migrate row data into drupal text formatted long multiple

I would like to import 3 different row values into a multiple text formatted long field. This is my migrate (plus) map yml: ... field_mytext_formmated: plugin: get source: - ...
1
vote
1answer
612 views

dynamically populate a select field based on the selection in another field works only the first time

I am trying to dynamically populate a select field (chamiponship) based on the selection in another field (country). It works fine when I load the page but just the first time, the second time I ...
0
votes
2answers
570 views

Embed a node add form on a parent node

I have a product display node and I'm trying to add a rental form to the node so that anyone can submit a rental form and have that reference the node. I was thinking of making the rental form a new ...
0
votes
1answer
625 views

What is the best way to add a confirmation tooltip to the remove button of a managed_file field?

Another Update I'm trying to implement the solution found here: Intercept click event on a button, ask for confirmation, then proceed, but the remove button still submits normally. I know my JS is ...
0
votes
2answers
2k views

Field Collection fields not displaying

I have been running into some trouble with displaying Field Collections. I have a content type (products) that has a field collection called packages. Randomly I would notice that sometimes the field ...
2
votes
1answer
859 views

How to expose filter for entity reference as dropdown in the Search API view?

In my Search API view, I'd like an Exposed filter > Entity reference to be a select box, not a text field. Details I have a view which I created like: Views > Add new view > Show: default node ...
1
vote
1answer
588 views

Adding conditional statements as Math expression to custom text fields in views

I have created views in which i have added custom text and Math expression. I displayed view in table format I created one Math expression which is noticed below: [Field 1] - [Field 2] I have ...
1
vote
2answers
1k views

How do I render form fields in my custom.tpl.php template?

Here's my dilemma, I built a custom form-based module that allows a user to vote on a future conference location but I'm having a issue printing or rendering my form fields to have them display in my ...
16
votes
3answers
14k views

Get all fields defined in a bundle

to get all fields used in a content type, in Drupal 7 I use the following code. $fields = field_info_instances('node', 'article'); What is the equivalent for Drupal 8?
0
votes
1answer
348 views

Field collection item not visible to anonymous user

I have a field collection, 'related content', that displays inside the 'page' content type tpl. It is a 'field' in the page content type. It works perfectly fine while logged in as admin, but cannot ...
0
votes
1answer
649 views

Simple webform with payment module

what I need do is not an ecommerce site. On my drupal website I need a simple web form with a payment (by paypal) and a node reference field prepopulated (by the entity refence and entity reference ...
1
vote
1answer
2k views

Entity metadata wrapper + entity reference + translation

I have two node types: 'festival', which can be translated and 'event', which untranslatable. Event has multivalued field reference to Festival, so that one Event referenced to all translated festival ...
2
votes
2answers
476 views

Displaying all values of a List (text) field, whether checked or unchecked

[Drupal 8] I have a List (text) field that allows multiple values, displayed as a check box list when editing. But when viewing the node, only the checked values are displayed. How can I display all ...
0
votes
1answer
403 views

How to get the actual value of a field in Views?

I'm using the Views module and Drupal 7 and want to add a class to all rows of my table that have a certain value for a certain field. The field is a bit field and is included in my query. I have ...
0
votes
1answer
22 views

Default all entities to English

At some point we will be enabling translations on all entities in Drupal 8. However, we are not ready yet so in the meantime we would like to set all of the entities (content types, taxonomy terms, ...
2
votes
2answers
643 views

Lock a Field Instance

Is there a way to lock a field instance? I want to prevent users from editing or deleting a given instance, but allow the field to be customizable elsewhere by the user. If I lock the field, it will ...
3
votes
1answer
802 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 ...
1
vote
1answer
1k views

Create an expiration date field that auto expires

We are currently migrating a Drupal 6 site to Drupal 8. We have a view that shows a table of files uploaded through the file depot. One of the columns on the table was an Expiration Date. In Drupal 6 ...
1
vote
1answer
2k views

How to change Title field label and description for Custom Content Entity [closed]

I've created a custom content entity (generated via drupal console), I can add custom fields just fine via the cms. What I'm try to do now is change the default label from 'Name' to 'Artwork Title'. ...
1
vote
1answer
872 views

How do I customize node.tpl to print an entity reference field in a specific format

I have content type called collection that has an entity reference field (multiple) that references another content type called books. One the collection node page, I want to render all of the books ...
3
votes
2answers
733 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 ...
1
vote
2answers
946 views

Profile field create and set default value programmatically

I need the checkbox to be checked by default. Below is my code, notice the 'default_value' under the settings array. $field_instance = array( 'field_name' ...
1
vote
1answer
2k views

Adding the video field to a content type

We've been using an SWF player for a while. I added the Video module without adding a new content type, just to see if the HTML5 tag worked. It does. However, that obviously doesn't give us an SWF ...
0
votes
1answer
770 views

Cloned node entity reference field stay in sync with parent node

I have three content types A, B and C. A have entity reference fields to B and C. I create a Node of type A say a1. When i clone a1 node as a2 with node clone module i get the same value for entity ...
4
votes
2answers
2k views

How do I filter by node ID in views?

I am trying to add Node ID in contextual filters but it seems there isn't Node ID anymore.
2
votes
1answer
89 views

How to add a theme preprocess function for published state?

I want to create a body class for the published state of a node. I found some suggestions below for Drupal 7, but this code is not working for my Drupal 8 theme. Add class based on published state ...
2
votes
2answers
747 views

creating nodes with many to many relationship type with some fields?

This is in line with How to structure a "many-to-many" relationship between nodes. To keep things in line with the example from the linked thread, what if i was a book warehouse and i had ...
0
votes
1answer
567 views

CCK checkbox or dropdown widget as a field?

I am trying to setup a new CCK field for a content type to display as a checkbox but I see I don't have that option in the widgets type. Shouldn't that be included in the default CCK? I am using the ...
2
votes
2answers
438 views

How to display custom data array via Twig

I've created service which gets the raw data from custom content type. It looks like this : Array ( [front_page_slider] => Array ( [1] => Array ( ...
22
votes
3answers
18k views

How do I render nodes, now that node_view() has been deprecated?

In Drupal 7 I frequently use node_view() for rendering nodes (using view modes) in blocks or pages as follows: $nids = array(123,456,789); $nodes = node_load_multiple($nids); foreach ($nodes as $node)...
5
votes
1answer
474 views

Why does loadMultiple load 1000 nodes 9.2 times faster than loading each node one by one?

I have always known that loading multiple nodes at the same time is faster than loading them one by one. What I wasn't aware of, is the huge performance difference between the two ways of loading ...