Stack Exchange Network

Stack Exchange network consists of 175 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
44 views

Add property to ProductVariationType via hook_entity_type_build()

Hy guys, I'm trying to implement a simple stock management in my e-commerce. The ProductVariation will have a stock_quantity field used to track product availability. I would like that ...
3
votes
1answer
433 views

Per Bundle Storage for Drupal 8?

In Drupal 7 there was the start of Per-Bundle Storage (PBS) to try to store field data in a single database table if that made sense and was possible given the nature of the field. The PBS for Drupal ...
0
votes
0answers
26 views

Entity Form Builder bypasses Access Handler on submit?

I have a ECK Entity, it is allowed to be edited only by admins. Under a custom route /test I load the form with \Drupal::service('entity.form_builder')->getForm($entity, 'default'); Now as an ...
0
votes
1answer
58 views

how to use “views field view” for entity reference - Not taxonomy

I've got a view of "webinars," that contains an entity reference "speakers" that can have multiple entries. I can't get those entity references and their own fields into the listings for each webinar, ...
0
votes
1answer
162 views

disabled=“disabled” on a checkbox entity field

I can't seem to figure out how to make checkbox field on my entity display as disabled in the admin form area. Looked in Drupal 8s "documentation" but couldn't seem to find anything on it. I tried ...
0
votes
1answer
263 views

How to handle Custom Validation in inline entity Form?

I'm using Drupal8's inline entity form and is having issue with writing custom validation. I found few links and wasn't helpful at all. Does anyone know how to handle this?
3
votes
1answer
162 views

How can I set up a “many to many” relation with an entity

How do I set up n:m database relation in a custom Drupal 8 module? I want to create task entities that may be related to different users (a task may have multiple related users and a user may have ...
0
votes
1answer
264 views

Render entity fields retrieved by EntityQuery

I'm building a table with TableSort retrieved by EntityQuery like explained in this post. The result fields vary a lot and I have a hard time to figure out how to render the results of the different ...
1
vote
1answer
26 views

Didn't we used to be able to type “entity:node/####” in a typeahead field?

When using any Drupal 8 link field to dynamically link to a node, I start typing the title and the typeahead function starts providing options to chose from. These are Drupal field types such as Link ...
0
votes
1answer
263 views

EntityQuery on nodes related by ERR and paragraphs

I have content type Publication which relates to content type Project using paragraphs: Publication [field_mention] -> Mention (paragraphs) [field_project] -> Project Now I want to show all ...
0
votes
1answer
67 views

Custom entity translation interface

I created a new custom entity using drupal console, I enabled translation and all looks ok in code. The problem is that I don't know how to translate an entity from the admin interface, I don't see ...
0
votes
1answer
52 views

Entity Reference - User reference field Hide “Restricted access” label instead of showing useless choices

i have an entity reference (7.x-1.5) select-list within a checkout pane which is being used to allow the user to attach a child to a product during a checkout process. The user can add multiple "...
2
votes
1answer
30 views

How to write hook_field_placeholder_info() for the link module?

The contributed project Field placeholder lets one use HTML5 placeholder attribute. The project page says: By default, this module integrates text, number and mail modules, but any other widget ...
1
vote
1answer
35 views

How to link to Entityform submissions page?

I am using an Entityform in a block to enable site users to submit enquiries to owners of holiday cottages. I need to be able to allow owners to view those enquiries. Each holiday cottage has its own ...
1
vote
0answers
40 views

How to assign permissions for a newly created bundle programmatically?

I am making a CRM management application based on Drupal. It will be used by a number of different organisations so I want it to be configurable. I have made a custom entity type called Person, along ...
0
votes
1answer
108 views

Image upload: Failed to open output stream

I created a media entity browser and for the image upload widget i choose the DropzoneJS.The widget settings are in the image bellow, pretty standard. And regardless of image type (png, jpg, jpeg) ...
0
votes
0answers
55 views

Use of node vs custom eck entity bundle

Is there a difference in weight (performance wise) in using custom eck entity bundles or nodes? So if I need to store data bundles with the following values(fields): Entity Reference to other node ...
1
vote
0answers
185 views

Entity Form: Override Submit Handler with Custom One

I'm loading a field collection item form inside of a formatter. Below is the function loading the form, which works. However I do not want to call the normal field collection submitForm handler, I ...
0
votes
0answers
131 views

How to create a Blob field type?

Is there a way or is it possible to add a Blob field type in Drupal 8? And save the files on the database? I know that there is a module Blob but it's for a Drupal 7.
4
votes
2answers
788 views

list of supported value in entity baseFieldDefinitions setDisplayOptions type(field widget)

I'm new in Drupal, I create my first entity and use baseFieldDefinitions to set fields and in fields I use setDisplayOptions to set form like this: $fields['piece'] = BaseFieldDefinition::create('...
-2
votes
1answer
214 views

Get the thumbnail of the uploaded video programmatically

I have a content type include a file field for uploading videos, what I want to do is to get the thumbnail of the uploaded video automatically from my custom module.
1
vote
1answer
34 views

How to add warning message before module is uninstalled

The module in question has a content entity, entity1, that has another content entity, entity2, that depends on entity1. I would like to add a warning before uninstall of the module if there are ...
1
vote
0answers
27 views

Combining entity forms on one page breaks file upload

In Drupal 8 I have combined a number of custom entity forms on one page using this example. Everything works perfectly except for file uploads which do not load. In the console it returns : XHR ...
0
votes
2answers
216 views

How to show entityQuery results as block

I use entityQuery to retrieve nodes related to actual content. Now I don't know how to add them to template and show them in my theme. In Drupal 7 I used Bean module to create blocks as entities. The ...
1
vote
1answer
284 views

Limit amount of adding a certain Paragraph per Content type

I use Drupal 8 Paragraphs module. I created a Content type Landingpage. I create some Paragraph types like Hero Image, Intro text etc. In the Content type Landingpage I created a Paragraph Entity ...
0
votes
0answers
46 views

Is there a way of deleting a file field without deleting the related file entities?

I'm working on a site that started uploading files via specific Fields appearing in Content Types, but has since moved to uploading them via admin/content/file/add for consistency. I'd like to delete ...
0
votes
1answer
135 views

How to programmatically update a paragraph field

Trying to get certain paragraph field of certain node updated with new value with the following code: function my_module_node_update($node) { if ($node->nid == '111') { foreach ($node->...
0
votes
1answer
89 views

Can't import configs on server due to some entities

So when i try to manually import configs (/admin/config/development/configuration) i get these messages: Entities exist of type Media and Media type Image. These entities need to be deleted before ...
0
votes
1answer
55 views

How to add a percent field in content type

Simple question. When creating a content type field, we have a float, decimal and integer number type, but how can we create a field with percentage type value, basically a range of 1-100%.
0
votes
3answers
98 views

Modify a custom block field value with hook_form_alter and validate

I'm trying to modify a custom block form with hook_form_alter .In its validate function I have a case where one of the field value needs to be unset. For modifying its value I tried with $form_state-...
0
votes
2answers
34 views

Available node language only English

I have a custom content type with "Set custom language as default for new content" and "Require language". Custom default language is Current language. Entity translation is defined with "Current ...
1
vote
1answer
132 views

How to replace allowed_values for a select field by external definition?

I created a custom content entity, called member, with some fields of which one, called status, is a list appearing in form as a select: $fields['status'] = BaseFieldDefinition::create('...
0
votes
1answer
44 views

Update image tags using entity metadata wrapper

I'm trying to bulk update image tags using entity_metadata_wrapper. I'm unable to see the image field when I use $emw->getPropertyInfo(). The bundle is called hub_page. The code I'm using is: $...
1
vote
1answer
190 views

EntityQuery not returning content based on language

I'm trying to get a list of all of a specific content type, but my entityQuery is only returning the original language of the site (English). Here's my code: public function ...
0
votes
1answer
52 views

Get all the text fields type and alter value after save

I'm trying to alter the value of entity text fields upon node save, even the custom-made fields so far I've managed to do that with the title and default body field but not with a custom field, I'm ...
0
votes
1answer
57 views

How to use views filter on an entity property

I used hook_entity_property_info_alter to add two properties to an existing entity [crm_core_contact]. I find that I can see these two new properties in the "Fields" section of views, and that my ...
0
votes
1answer
17 views

Display node with mixed languages

My nodes, with entity translation enabled, need to be able to handle a node where the content of the node is displayed differently regarding the labels and menus. Let's say I am on a french page, ...
6
votes
2answers
161 views

Why do so few code examples use the ::load($id) method for loading entities?

Over at How to get term name from a tid? the accepted answer for "how do I get the name for a Term" is this: use Drupal\taxonomy\Entity\Term; ... $term = Term::load($tid); ... That's really nice, ...
0
votes
0answers
11 views

Entityform Revisions create a new revision by default?

I just installed the Entityform Revisions module for Drupal 7. All it does is provide revisions for entityform submissions. Works as described. However, unlike the setup for a content type, there ...
1
vote
1answer
41 views

For external data, should I create custom table or new entity type?

I have a database that exists outside of Drupal. I wish to show the summarized data from that database on Drupal. At a high level, you can see the structure of the data below. | Seller's ID | ...
0
votes
1answer
39 views

Get list of nodes by field-collection value

I am having field_feature as a collection of fields (field-collection) in a content type called 'watches'. Those fields are, field_water_resistance -> water_resistance(Term Reference) field_gender ...
1
vote
1answer
43 views

Get all nodes where date field matches month and year

I have a content type with a date field (myFieldDate) whose values are timestamps. (I'm collecting only day, month, and year.) I have a custom form where I have a select list to select month and year....
1
vote
1answer
23 views

Create entity view block

I have 2 content types: schools and courses. On the schools content type, I created a field called 'Courses At This School' which is an entity reference field to the courses content type. So, I edit ...
0
votes
1answer
30 views

Update user profile picture using entity_metadata_wrapper

I am trying to update the user profile picture using entity_metadata_wrapper. But I am getting "Unknown data property picture." error. When I check the user property info, I cant see the ...
0
votes
1answer
61 views

Update entity properties fetched with entityTypeManager()->getStorage

I am loading all entity types I need to update like below $current_fruit = \Drupal::entityTypeManager()->getStorage('fruit')->loadByProperties(['status' => '1']); Then I update them in a ...
0
votes
0answers
75 views

Two way referencing content type with entity reference fields - show all references on node edit form

I am creating a website that has a content type called “School” which will hold names and details of schools. I also have a entity type called “courses”, which holds the names of courses that the ...
0
votes
1answer
33 views

How to display current pages the media entity is referenced during deletion?

We are using Media Entity module that provides a Document media bundle. On our Article content type, we have created an Entity Reference field to Media that is set to Document media bundle. When you ...
2
votes
2answers
47 views

How to not have “-None-” as default in the entity reference display widget

I spend hours to figure this out but no result. I want to auto-populate a field using entity references and views. A field has a user entity reference Using filters, I made a view narrowing down ...
0
votes
1answer
55 views

Unable to perform update when adding new menu field

I'm attempting to add a custom image field to my menu from a custom module like so function my_module_entity_base_field_info(EntityTypeInterface $entity_type) { $fields = array(); if ($...
0
votes
1answer
25 views

How to create a node with mulitple field-collection items?

I've a content type having filed collection item (3 fields of 5 sets). Created a custom module form, when user submits that form, it should create a node with all 5 set field collection items. So far ...