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
2
votes
1answer
86 views

Custom migrate source plugin, extends FieldableEntity class, has migrate status of [error] No migrations found. Why?

I'm writing a migrate source plugin for migrating D7 entityform (entityform module) submissions. If anyone has done this or knows an existing plugin, please let me know. I am trying to extend the ...
0
votes
0answers
19 views

Move entity properties into existing tabs like Node?

When creating a custom content entity, how can I get the properties to automatically arrange themselves on the form like adding/editing a node does out of the box? I'd like the experience to be ...
-1
votes
1answer
14 views

Creating a Select List + Textfield

I'm trying to create a supplies field made up of a select list (or entity reference) and a number field. Users should be able to create several of these. For example, the link field has a URL and ...
0
votes
0answers
6 views

Limited editing of just the order of entity reference field

I would like to give some users the opportunity to edit the ORDER of a field of entity references holding multiple references-- but not the references themselves. One option would be to post process ...
0
votes
0answers
27 views

How to display scheduler module fields?

I'm trying to display values of the scheduler module fields publish_on and unpublish_on. Does anybody know where to find them? I cannot find them in /admin/structure/types/manage/article/fields. I was ...
0
votes
1answer
34 views

Increase maximum amount of characters for entity reference field (tag style)

I have a Drupal 9 installation running Commerce 2. My products use a taxonomy entity reference field (tag style). There's one products category, where I need to have more references in the tag input ...
0
votes
0answers
25 views

How to connect different node bundles in one page

I am building a web site about football teams in Drupal 8 and I have the following content types Team, Player, Manager, Game etc. I would like to connect nodes from Player, Manager content types in ...
0
votes
0answers
23 views

Custom entity field UI "EntityDisplay entities can only handle fieldable entity types."

I've created custom entity using drupal console and added my required properties using base field definitions. Everything was working well in that I could add and view the entities until I changed a ...
1
vote
1answer
48 views

Entityqueue - Get field values from the queue

First off, i'm very new to Drupal. Kindly help me and forgive if im being a noob. Im using the module - Entityqueue https://www.drupal.org/project/entityqueue Im created a view block for a entity ...
1
vote
1answer
45 views

How to display a node edit form in custom URL

I have a node created (using Default content) as part of the site install and it is available to edit at node/[nid]/edit. However, this node holds some of the site-specific content (for example, ...
0
votes
0answers
42 views

Get original entity in a constraint

Is it possible to get the original entity in a constraint? Use case: create a constraint on which item can be deleted in a multi value field
0
votes
0answers
28 views

Combine two Media fields in Product types and Product variation types

i'm drupal beginner, i install drupal 8 commerce 2, i create a media field in Product types and create another media field Product variation types also. when i create new product, i want to give user ...
1
vote
1answer
41 views

Is there a hook that could manipulate the list of field items before the field is built?

I am currently porting a custom field module from Drupal 7 to 8. The field (Topic Access) has 3 select fields, typically about 10 to 20 items per field, and uses a custom widget. When the form is ...
0
votes
1answer
130 views

How to get fields definitions of a vocabulary in drupal 8/9? [duplicate]

I needed the field list related a vocabulary item.I was able to list the fields related to a content type by using like this: \Drupal::entityManager()->getFieldDefinitions('node', 'article'); But ...
0
votes
1answer
90 views

Disable Inline Form Errors

I'm encountering the bug described at "Login form error message is redundant and does not make sense". In short, if a user enters invalid credentials once, an inline error message appears on ...
1
vote
1answer
165 views

Use entity reference to target revisions of an an entity

I'm building a custom entity document which supports revisions. Revisions are seen as versions of the document (v1.1, v1.2, ...), the title field is revisionable as well. Then there is a custom entity ...
0
votes
0answers
17 views

Can't generate stack trace for EntityMetadataWrapperException, even with Devel and ddebug_backtrace()

I have the following error on a product display page on Drupal 7 : EntityMetadataWrapperException : Unknown data property field_attribute_name. dans EntityStructureWrapper->getPropertyInfo() (ligne ...
0
votes
1answer
23 views

Field weight in display mode is not respected on custom entity

I have a custom entity type with a set of base fields and I can create/view/update/delete entities. However When I create & enabled a custom view mode to the entity type and set to display subset ...
1
vote
1answer
183 views

Media library widget: Table instead of grid?

Background I have a multiple-value entity reference field with target type = media. It is used for "document" media, so mostly pdf files. I am using the "Media library" widget ...
1
vote
0answers
26 views

"Display" checkbox to show/hide media reference field items?

Background In Drupal 7, a file field does have a "Display" checkbox per field item, to show / hide the respective file. In a Drupal 8 migration project, we are migrating such fields as ...
0
votes
1answer
53 views

Token does not return full dynamic path to Media Image URL

I'm having trouble configuring Metatag for Open Graph and Twitter Card images. I'm using Drupal 8.9 core Media Image reference field as the source. [node:field_hero_image] (Entity reference field) ...
0
votes
1answer
320 views

Entity revision metadata key missing after upgrading

After upgrading a site to Drupal 9, I started seeing the following error when visiting the site: Drupal\Core\Entity\Exception\UnsupportedEntityTypeDefinitionException: The entity type banner does ...
0
votes
1answer
30 views

Circular dependency on base fields' module

I have 3 custom modules that provide custom entities with all fields defined as base fields. Contact module - provides a contact entity(it could be one of the type: a person or email or phone etc) ...
-1
votes
2answers
57 views

Updating user leads to sql integrity issue

Please help me find what I am doing wrong to update a user field. I am trying to update all existing users in my Drupal 8 instance. I could do the same thing easily in D7, but can't get it working ...
0
votes
1answer
91 views

How do I validate an entity before programmatically saving it?

I have various functions/methods that programmatically create entities (nodes). I just noticed that invalid data has been getting stored in the db though these functions (invalid in that it doesn't ...
0
votes
2answers
134 views

Converting a Views SQL query with INNER JOIN to an EntityQuery

I'm trying to create a custom JSON:API resource that returns the entities that have been flagged by a user. (The Flag module does not offer a way to get this out of the box.) I used Views to build a ...
0
votes
0answers
71 views

Custom entities

I am a Drupal 7 avid user and I am just getting into Drupal 8 development for work. The project we are currently working on involves creating about 3 different custom entities (not nodes, users, etc). ...
1
vote
1answer
30 views

Adding the category for a custom entity reference field add other fields to the same category

I have a custom entity reference field working well, but once I added the category to it the other entity reference fields appeared in the same category. Here is my code: /** * Plugin implementation ...
1
vote
0answers
41 views

Field type where big data is not loaded into memory if not needed

Background Normally when an entity is loaded in D7, the 'field_attach_load' step will load all the data from fields into the entity object. The field_sql_storage_field_storage_load() loads the data ...
0
votes
2answers
41 views

Hide comment box from node for Anonymous users

I am trying to hide the comment box for anonymous users. Anonymous users should only be able to view the comments. How can I hide the comment form?
0
votes
1answer
37 views

How can I limit an entity reference selection to a specific field value on the reference

I have a content type Research which has a an entity reference type of People. The problem is that I don't want to show ALL people but only people which have a certain value under their field named ...
0
votes
1answer
21 views

How can I have a new dropdown for each entity reference added?

I have a content type with an entity reference to another content type that has over a hundred items. I want to use a dropdown menu to select the entity, since the user won't always know the titles of ...
0
votes
1answer
142 views

How to put view results in an entity reference field?

So the scenario is like this: I have to create a "node" which has an entity reference field which can hold multiple values. I am looking for a way to be able to select view results to be ...
0
votes
0answers
48 views

Placing a block on an entity

I am aiming to place a block on an entity. It seems like this should be simple as entity integration in D8 is well-developed and (in parts) user-friendly. I can get the view block working fine and can ...
0
votes
1answer
54 views

Unprocessable Entity: The following relationship fields were provided as attributes

I'm trying to set the value of a taxonomy term entity reference field with a POST operation in JSON:API. const data = { data: { type: 'node--page', attributes: { field_text: { ...
0
votes
0answers
31 views

How do I set a grouped exposed filter of boolean fields in a view?

I have a view with fields used as filters and exposed to user in a dropdown. They are "grouped" in the filter section. These fields are boolean. I can't get them to work together. It's ...
0
votes
1answer
35 views

Correct way to get field definitions for entity types

I'm still pretty new to D8 so I'm getting to grips with the new way it deals with fields and the OOP way of doing it etc. I've got a hook in my module which I'm trying to add a submit handler to ...
1
vote
1answer
64 views

add Bundle field to a custom entity

I am trying to add a new bundle field into my custom entity, I added the following code into the MyCustomEntity.php file, I uninstalled my module, so, I installed it again, the field is showing up on ...
0
votes
0answers
136 views

Is there a way to apply cached access results to listings?

Code that is put in either hook_entity_access or an access handler has no effect on listings such as views field displays and search. I am not sure if this is by design or due to an error from my side,...
0
votes
1answer
22 views

How to modify the subfields of a custom field in hook presave

I have a custom field in a custom module that consists of 4 varchar type values. Each of these subfields are called 'prefix', 'suffix', 'body' and 'header'. In the hook presave, I want to modify only ...
2
votes
1answer
80 views

Add a custom action on admin content page

I want to add a custom action to the dropdown on the admin content page (/admin/content) as shown in the screenshot below using Drupal 9. The views module is enabled so that form is part of the view. ...
-1
votes
2answers
52 views

Add new field related with other (this field isentity reference) - Custom entity

Is it possible to add a new field related to the entity reference field? Let me explain, I have one field called "student_id" which is an entity reference type, so I need to assign one ...
0
votes
1answer
61 views

Entity Reference returns blank content

I thought that omitting code and being more graphic was going to improve the question, but that only made it score negative hehehe. So I'm going to put in some code to make it look clearer. Here is ...
0
votes
1answer
18 views

How to render full profile2?

I am tring to load a full profile2. I a trying the following code <?php $uid = user_load($node->uid); $profile2_p = profile2_load_by_user($uid, 'profile2_profile'); print render($profile2_p); ?&...
0
votes
0answers
15 views

Commerce Marketplace Missing Roles and Buttons

My Install Drupal 7.77 Drupal Commerce 7.x-1.15 Commerce Marketplace 7.x-1.0-beta4 (all dependent modules are enabled) I have reviewed: Documentation mentions a Marketplace Owner Role https://git....
0
votes
0answers
40 views

Store custom field with SQL transaction

I have a custom module that implements a custom field. In that custom field, I have an integer. This integer is optional. The user can insert anyone or leave it empty. If the field is empty, the next ...
0
votes
1answer
121 views

Changing entity base field settings

Changing entity base field settings I have a custom car entity with 8 base fields like the following: $fields['color'] = BaseFieldDefinition::create('list_string') ->setLabel(t('Color')) -...
0
votes
0answers
109 views

Custom field with a custom entity reference

I have a custom content type 'project' with a title 'project_no'. I am creating a custom field 'project_reference' to be used in other content types. It has few fields; one of them is an entity ...
0
votes
1answer
80 views

How to display configuration updates when deleting fields programatically

I am working on a module that adds it's needed fields automatically when you enable it's function in the UI for specific entity types. It also deletes it's needed fields when you disable it's ...
1
vote
0answers
41 views

How to update entity value programatically after submitting the form?

I try to update automatically entity title after form is sent. I tried that in form_alter, but everybody guided me to use entity presave. I cannot manage to save the updated title however (please see ...