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

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

1
vote
1answer
79 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
11 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
22 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
14 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
14 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
31 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
0answers
8 views

Use multivalue field collection on a webform

I want to build a field collection and give the opportunity to the user to add more than one field collection. The field collection is named Office and it contains the fields Desk, Chairs and ...
0
votes
2answers
26 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
0answers
41 views

Listing the users and roles in a content type

I am using Drupal 8 and I have a restricted content type with only specific roles with read/edit access. I need to be able to list all the users of these roles in a checkbox list when you edit the ...
0
votes
0answers
29 views
+50

Contextual filter in media browser view not accessible on autocomplete filter ajax call

I'm having a view which filters Media type and has contextual filter of Entity browser context. This view also has an exposed filter of text box field with autocomplete enabled which filters by media ...
0
votes
1answer
36 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
31 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
25 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
0answers
15 views

How to expose the role of an entity reference user?

Using Drupal 8.5.x I have a content type with a list of user as Entity Reference. The reference type is connected to a view. The entity reference lists the selected users, both Primary and Secondary ...
0
votes
0answers
12 views

Bulk edit a user reference field inside a view

I've created a view and enabled bulk edit operations. The field I am interested in changing is of type User Reference. When I attempt to bulk edit the fields, everything works as I'd expect. However, ...
0
votes
1answer
28 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
15 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
87 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, ...
-1
votes
0answers
48 views

How to insert the created node into 2 Message Stack templates? [closed]

I created my first custom module based on the Message Stack module. I created 2 Message templates in Drupal 8: Message Activity Stream - Create node mas_create_node (It creates a message when a node ...
0
votes
0answers
8 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
0answers
26 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
17 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
18 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....
0
votes
0answers
15 views

How are new view modes numbered when adding to bundle-less, custom entity

I have created a bundle-less entity type and added two new view modes. I plan to programmatically use them to populate a radio button using this logic (How can I get a list of all available entity ...
0
votes
1answer
19 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
12 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
0answers
21 views

How to use filter by reference entity view dynamically

I have 4 custom content types, Customer, Package, Term and Licence. The customer has an entity reference to multiple Licences (to keep track of multiple licences, some of which may have expired). Each ...
0
votes
1answer
24 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
13 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 ...
-1
votes
0answers
11 views

Views entity reference filter output (relationship problem?

Any Views pros out there? I'm stuck with the output of my select list using a Views Entity Reference Filter display I created. So... I have a Content Type "Movie" with a Field Collection "Cast". In ...
0
votes
1answer
27 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 ...
0
votes
0answers
22 views

IHow to perform inline editing of embedded entities?

We are using Entity Browsers with Entity Embed to allow someone to create and embed an entity in CKEditor. We would like them to then be able to edit that entity. When you double click on the entity,...
2
votes
2answers
21 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
15 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
0answers
17 views

Edit entity in body field pop-up box

What I am trying to do is have an entity embed button in a body field that lets you create, edit, and embed an entity from the click of a button, in a body field. I have the creation and embedding ...
0
votes
1answer
38 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
18 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
90 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
28 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
60 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
36 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
61 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
33 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
53 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
22 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
20 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 ...
1
vote
1answer
28 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
17 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
21 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 ...
0
votes
0answers
30 views

Overlapping/Overriding YML for node display

The situation is adding a content type with a module, and using yml to define its fields and their display, and THEN adding a second module that adds additional fields. How do I set up the yml in the ...