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
0
votes
1answer
12 views

Allow to filter (in a view) on a datetime field of a custom entity

I have created a custom entity as follow: Here is an extract of my entity definition in modules/custom/bank_operation/src/Entity/BankOperation.php Notes: 1- As you can see, I have changed the value ...
-1
votes
0answers
28 views

How can I use “OR” in the context filters of the view? [duplicate]

I have a site built with Drupal 8. I created a view with 2 relationships for 2 different entities. I added to this view 2 context filter (store ID) for the 2 relations. My problem is that View doesn't ...
0
votes
0answers
28 views

How to use one of the 2 context filters in a view (with an OR)?

I have a view with 2 relations with the store for 2 different entities. I want to filter the view with the store id for the 2 relationships. I created 2 context filters in the views. You must use the ...
-4
votes
0answers
13 views

Autocomplete is not working for entity reference

Autocomplete is not working for new data in entity reference field but if I am changing the wiget type to list in that case all data is coming.
3
votes
1answer
41 views

What's the difference between indexed and non-indexed field in Views and Search API?

I'm using Search API with a database backend and Views to build the search results page. More specifically, I'm using fields in Views. When selecting fields, I see two options for example: Title ...
3
votes
1answer
97 views

How can i add a property(uuid) to existing custom entity base_table?

I want to add uuid property to existing custom entity extending ContentEntityBase. I've tried to a add the uuid entity key and installed field storage definition by: function ...
0
votes
1answer
34 views

Body text special characters are escaped

I have this code which I am using to get the body text from a node rewrite it with a regular expression and replace it, (I am replacing all you tube video links with embed codes) function ...
0
votes
1answer
12 views

IF statement to check if loaded entity is of type

In my module (fork of ECK Clone) I'm trying to set a default value when an entity of type "Course" is cloned. Currently I do: function eck_clone_clone_entity($entity, $account = FALSE) { $...
0
votes
1answer
13 views

Create a view of the first entityreferenced child item from a multifield for a list of parent nodes

I have a node type A containing a multifield of entityreferences to another node type B and using only the views admin interface I want to create a list of the first type B child entityreference on ...
0
votes
1answer
56 views

Newly created field not being added to entity

I have created a form that adds a subset of field types to an entity (does not support bundles). (the reason for the custom form is that end users find the Drupal standard 'Manage fields' workflow ...
0
votes
1answer
19 views

Exract all node field values to json including reference entities with value

I am writing a module to export drupal's content to another platform, the module provides a UI to manage content types and their fields to be shared on another platform via API. So far i have managed ...
-3
votes
0answers
20 views

Autofill drupal field in edit page [closed]

I am not sure if this was posted earlier, but I would be specific and conscise. I am writing a Drupal module to store post meta in the "Node edit" page field. Just basic field, in node edit ...
0
votes
2answers
127 views

OO way of adding base field definitions

Is there any object oriented Drupal way to add a base field definition to an existing entity? Of course I am familiar with hook_entity_base_field_info(), but I am trying to keep my .module file size ...
0
votes
1answer
44 views

How to use “content entity” type in a View?

I have used the "content entity example" coming from the example project. This example module/: defines a "Contact" entity; it can have extra fields, displays can be configured (...
-3
votes
1answer
52 views

Undefined function 'entity_metadata_wrapper'

A custom module is using the following code. function sun_blogs_views_pre_render(&$view) { if ($view->name === 'blog_listing') { if ($view->current_display === 'page') { Drupal::...
0
votes
0answers
36 views

Programmatically add field automatically to all new bundles [duplicate]

I have a module with a bundleable content entity that has been deployed to an existing site. On the site, a bundle was created and a date field was manually added to it via the UI. Now the date field ...
0
votes
0answers
53 views

How can I create a view of different entity types with common sorting?

Both, profiles and nodes (of one spec. nodetype) have the same taxonomy attached. (Using the profile module). How to create a view of both together, profiles and nodes (of this type) to show as a ...
0
votes
1answer
27 views

How to get the “label” of “Allowed Values” for a text list programmatically?

I created a text list field on the user entity. I entered the following for Allowed values list: apple|A delicious apple pear|A very delicious pear orange|A not so delicious orange I can access the ...
0
votes
0answers
17 views

New fields are not showing in Re-use an existing field

I am using Drupal 9 and I have a page where I will be using a lot of the same fields (e.g. links, subtitles, paragraphs) throughout the page. I created my first field for subtitle in /admin/structure/...
0
votes
0answers
10 views

How can I assign multiple files to the same field in a migration lookup?

In a first migration step, I import files. Therefore, I read a csv file, containing filenames and attributes about the files. Files can share the same attribute like so: file,attribute,... ex1.pdf,666,...
0
votes
0answers
23 views

Concurrently updating field data results in lost updates

I have a field_whatever (allows unlimited values) on the user entity and this API endpoint: # mymodule.routing.yml mymodule.foo: path: "/api/foo" defaults: _controller: '\Drupal\...
1
vote
1answer
58 views

Create basic field data in template like node for custom entities {{ custom_entity.id }}

I see node preprocess does this $variables['node'] = $variables['elements']['#node']; and then in the template one can do this {{ node.id }} but when I create a custom entity and do the same, I never ...
0
votes
2answers
24 views

Entity query on custom entity is not checking access rights

I have a custom entity called project_member. Not all user have access to this entity. But when I query this entity with entityQuery as follows \Drupal::entityQuery('project_member')->execute() all ...
0
votes
1answer
13 views

Display node content with frontend theme in admin route

I need to display content with the frontend theme in an admin page to get a preview. I get the content and built it with the ->getViewBuilder('node') but the template used is coming from the admin ...
0
votes
0answers
12 views

How to set multiple default values in cshs field using form alter?

I am using cshs widget on my taxonomy entity reference field. The taxonomy entity reference field can accept unlimited values. I want to set the default value for this field using form alter based on ...
4
votes
0answers
70 views

How best to determine what differs between field schema and field definitions when “Mismatched entity and/or field definitions” is reported?

I've inherited a large, enterprise Drupal 8 site in which we have many "Mismatched entity and/or field definitions" warnings reported in the status report. The site is currently running on ...
0
votes
1answer
66 views

Value in my custom base field added to user entity isn't saved

I've created a new custom basefield for user entity type like this: function hd_is_integration_entity_base_field_info_alter(&$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type) { if ($...
0
votes
1answer
15 views

Entity reference additional field

In D7 I have two new node type defined e.g. branch and leaf. The branch is a collection of leaves that I'm referring to using the entity_reference module. In the picture below the leaves are the nodes ...
0
votes
2answers
42 views

Module getting “$entity” argument error with hook_entity_presave()

I am trying to create a module in Drupal 8 (8.9.11) and this module uses the function hook_entity_presave in order to update a node / entity programmatically. I've tried the answers from ...
0
votes
0answers
25 views

How to migrate content (fields and paragraphs) into another content type?

My problem is following: Initial situation At my Drupal 8 site I have a node content type (let's calling it node content type A). node content type A has normal (core) fields included and also holds a ...
0
votes
1answer
28 views

VBO hook_entity_update

I would like to perform the following mass action via VBO: send a mail to author of a node. This mail is configured and sent in a hook_entity_update function. The beginning of the function is the ...
0
votes
0answers
29 views

How can I delete a field translation in node?

I am using a complicated melange of paragraphs with asymmetric translation, and in a few my nodes there is a stubborn translation that somehow is stuck. Its a node that used to be translated, but then ...
0
votes
1answer
63 views

How to automatically add http prefix to links in a form?

I am trying to come up with a solution to fix the D8 Link module to allow URLs like example.com (the most common use case, imho). I was thinking it would be simple enough to modify the submit value ...
2
votes
1answer
42 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
5 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
25 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
21 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
13 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
29 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
31 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
40 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
23 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
35 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
54 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
28 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
96 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
14 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 ...

1
2 3 4 5
172