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."

1
vote
0answers
32 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
67 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
38 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
119 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
81 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.
2
votes
1answer
361 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
112 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
33 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
23 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
143 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
200 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
30 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
80 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
55 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
36 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
59 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
31 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 ...
0
votes
1answer
84 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
41 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
116 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
50 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
52 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
146 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
10 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
40 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
30 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
25 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
22 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
28 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
45 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
45 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
32 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
37 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
0answers
18 views

Trying to access and print a value from an entity reference field on a custom block [duplicate]

I have a custom block with an entity referenced field that I have added and I'm trying to fetch the value from the referenced node. I have tried different syntax in trying to access and print the ...
0
votes
1answer
52 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
23 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 ...
2
votes
1answer
166 views

What is the difference between getValue() and referencedEntities() to fetch paragraphs?

What is the difference between using getValue() and referencedEntities() in order to get the paragraph on a node? See example below. Both examples are used in a node template such as node--page--full....
1
vote
1answer
36 views

How to add constrain validation on entity_create

So in my BaseFieldDefinition I have this below $fields['name'] = BaseFieldDefinition::create('string') ->setLabel(t('Name')) ->setDescription(t('The name of the Crypto entity.')) ->...
2
votes
2answers
305 views

Finding the host node of a paragraph

I'm trying to find all the absolute URLs in a site (in wysiwyg content, url fields, config) to convert them into relative URLs later via manual administration. All the URLs in question are within the ...
0
votes
1answer
60 views

Plugin Derivatives For Queue and Migration Plugins

I've created a custom Content Entity and a custom Content Entity Type, basically I'm mirroring the Node module but the purpose of this is to have external data to be synced with this setup(not using ...
0
votes
1answer
198 views

Custom node migration for multi-value imagefield

I'm working on a custom migration module to "link" images to the imagefield. It's work well for an unique value image field like this: field_illus_vdl: - plugin: d6_field_file source: ...
3
votes
1answer
47 views

Only render translated nodes, prevent rendering of base language node

Having an entity reference, Drupal 8 automatically renders the base language of a referenced entity if it isn't translated yet. Is there a way to globally prevent that? So if there is ContentType1 ...
0
votes
2answers
181 views

Error during entup when removing a field added in entity_base_field_info

I am removing a field that was added using hook_base_field_info: /** * Implements hook_entity_base_field_info(). */ function MYMODULE_entity_base_field_info(EntityTypeInterface $entity_type) { $...
0
votes
0answers
82 views

I'm getting an error TypeError: DateTime::__construct() expects parameter 1 to be string when trying to format the date.I

Using entity reference I'm trying to fetch the field_date of each node and print it to twig. function _preprocess_newsdesk_node($entity, &$variables) { $entityStorage = \Drupal::service('...
1
vote
1answer
26 views

Where does the value of entity come from in a field of a content type?

Where does the value of entity come from in a field of a content type? I am trying to understand how the property (if it is a property) entity is related to the field. This question is more ...
2
votes
1answer
65 views

Where to find all possible keys for BaseFieldDefinition -> setSettings()

I am a noob to Drupal. I am trying to create a module and am currently in the process of creating a content entity and defining its base fields. Can anyone tell me where I can find a list of possible ...
0
votes
0answers
116 views

Link reference to taxonomy term to a node

I have this content type Project that can have one or more references to a taxonomy term District. For each of these terms they reference another content type just once, District Page. Project -(...
0
votes
0answers
41 views

Inline Entity Form not saved on node/add

I have a cck called "Biological Collection" that has a fieldset of Inline Entity Fields(Blood, saliva, etc..) all referencing to the same cck "Collection Fieldset". (please see screenshot1) While ...
2
votes
1answer
248 views

How can I change a field cardinality?

I have two content types: Person and Office with existing content. The Person content type has an entity reference field to Office nodes, which only allows a single reference. I need to change this to ...