Stack Exchange Network

Stack Exchange network consists of 174 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."

0
votes
1answer
14 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 ...
-2
votes
0answers
7 views

How to import Users and two other entities from CSV file? [on hold]

In a custom module I created to manage a non profit organisation, I have two custom entities Member (A) and Person (B) with a one to many relationship from A to B. Person is linked to User (as Drupal ...
2
votes
1answer
544 views

How to manage reservations with a 2 hours duration without duplicate bookings?

I want to make a calendar view that will show when music teachers are available, so that students can register online and attend a lesson. The courses have all the same duration which is 2 hours. For ...
1
vote
1answer
531 views

Parameters in the HTTP request

I am trying to render a block depending on the parameter(entity) present in the requested page. Suppose if I am on a url like this: http://localhost/drupal8/user/1 then a block with label user is ...
0
votes
1answer
546 views

Creating paragraph entities and adding to a node

I am using the Paragraph module in and I need to programmatically create paragraph entities and attach them to nodes. Using the following code in a for-loop: $paragraph = new ParagraphsItemEntity(...
6
votes
4answers
3k views

Expose custom entity to views

I've created an entity in a Drupal 8 custom module. Right now it's just an entity with base fields. I want to expose these base fields to views. I have the entity appearing on the views wizard page, ...
0
votes
0answers
10 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
1answer
531 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
1answer
533 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 ...
1
vote
2answers
548 views

Entity form submission sending email

I'm working on entity form using the module "eform" in D8. I would like it to send email when the user submits a form. It was done using some other modules rules and entity rules, but since "entity ...
1
vote
1answer
199 views

What is EntityStorage?

I'm attempting to understand the concept of entity storage. For example in this tutorial https://www.sitepoint.com/drupal-8-version-entityfieldquery/ it's using code to load the nodes from nids in a ...
-1
votes
1answer
559 views

Add a field programmatically to taxonomy

We have a field.storage.taxonomy_term.field_name.yml file that adds the storage configuration for our custom field. The field is available to be added from the GUI to each vocabulary. The issue we ...
-1
votes
0answers
10 views

Multi-image image field for a custom content entity

I'm creating a custom entity and requires a field that takes up multiple images, such as in the case of slick carousel, on drupal 8. Any help on how to approach this?(New to drupal)
2
votes
1answer
560 views

How can I theme field collection forms?

I have a field_field_collection in content type (used to field collection module and have unlimited value). It has a number of fields as in the picture below: And I want customize theme for it as ...
0
votes
1answer
550 views

How to download the files data attached to webform

I have webform with text fields and file upload field. How can i download the all the documents which was uploaded through this webform.
0
votes
2answers
559 views

How can I pass variables from views template to node template?

I have a view of contents of a content type. This content type has fields which references entities of another content type (and that in turn references another set of entities of yet another content ...
1
vote
0answers
42 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
1answer
554 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 ...
-1
votes
0answers
25 views

Dynamic content entity reference

Our team is working on Drupal 8 project where most entities are created from code with Entity API, so-called Content Entities. We have two entities ExternalPerson and InternalPerson which are mostly ...
-2
votes
0answers
30 views

How to add new field to Node entity itself

I have site with a several views which displays multiple different content types. The results display a different (SVG) icon on them based on the content type. Which icon to display is done with a ...
5
votes
4answers
8k views

Using Twig how can I get the summary of the body field to use in a template?

So I have a textarea with summary and I want to display the summary before the content. So if I just use {{ content.body }} the text is displayed without the summary. How can I get the summary ? {{ ...
0
votes
1answer
552 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
2answers
564 views

How to validate deletion of custom entity?

I'm making decently complex system, where many entities are referencing each other, and I don't want to allow any broken references. That is why I would like to implement validation at entity deletion,...
5
votes
3answers
82 views

Require field on publish only

I have a D8 site on which I would like to require an image field to be completed only when a node is published; if the publish box is not checked, the field should not be required. I was able to do ...
1
vote
1answer
310 views

Customise entity reference autocomplete

How do I override the look up on an entity reference autocomplete field? I would like to limit the look up to nodes of a certain type that have been created by the user that is creating the current ...
0
votes
2answers
552 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 ...
1
vote
1answer
76 views
+100

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 ...
1
vote
2answers
48 views

How to know “keys” for Entity::create()

The document says Entity::create() takes "$values (optional) An array of values to set, keyed by property name" as an arguement. I also found snippets like $term = Term::create([ 'name' =&...
0
votes
0answers
14 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 ...
0
votes
1answer
657 views

CSV import to content type

While migrating from csv file to content type in drupal 8 , fields like Geolocation and Address are of type field collections , so for mapping those fields am using migrate source csv and migrate ...
2
votes
1answer
594 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
26 views

Does Entity Autocomplete has database leak?

Lately in one of our prod database the "key_value" table became 2.4GB large. When I took a closer look I could see that there is around 200 000 records in it, and 90% of them are entity_autocomplete ...
2
votes
1answer
632 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
567 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
586 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.
0
votes
1answer
578 views

How to access weight of a paragraph in twig?

I use paragraphs with my content type. I need to show weight (order) value of each paragraph in my twig template. I can change weight with select box when I edit the node, but I can't figure out how ...
0
votes
1answer
566 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
583 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 ...
1
vote
2answers
578 views

Dynamically Theme Boolean Fields

I am trying to dynamically display boolean fields into columns based on their value. So for instance these 10 boolean fields on my node, if marked 1, I want it to theme it so that they show up in a ...
0
votes
0answers
30 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. ...
1
vote
1answer
22 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 ...
1
vote
1answer
613 views

How to know the format when programmatically setting a field value

I am trying to create a set of entities based on a CSV file on install of a custom module. The entity has a price field and I don't know how to find out what I should be passing in as a value, the ...
3
votes
1answer
582 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 ...
0
votes
2answers
27 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
19 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....
3
votes
2answers
591 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
2k views

Get field (list type) label in a twig template

I have a content type (appel_offre) with a field_categorie_avis field, which is a list type with these values. ouvert | Ouvert toute l'année restreint | Restreint 24h concurrence | Appel public à ...
0
votes
2answers
24 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-...
1
vote
1answer
595 views

How to make a reference to an entity using the uuid of the entity?

Is there any way to make a reference to an entity (using refereces, entity reference or relation) using the uuid of the entity? I'm using features and uuid_features to export the content but ...
1
vote
1answer
602 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 ...