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
1
vote
1answer
30 views

How to load a file entity by uuid?

So I am trying to use the default image for users in a menu block if a custom one does not exist. And for it I am getting the image file uuid: $default_image = $user->get('user_picture')->...
0
votes
0answers
12 views

How to use [node:title] token as filename for media type fields?

I have a Drupal 9 site have two modules FILE (FIELD) PATH module and token is used. So for a content type, one image field is there where in the File (Field) Path settings I have the file name as [...
2
votes
1answer
37 views

Validation on custom entity edit form

I have a custom entity where, instead of using the usual way of specifying edit form options with setDisplayOptions('form' and relying on ContentEntityForm to create my edit form for me, I have to ...
1
vote
0answers
25 views

How can I avoid double line breaks (<br><br>) in a text field (field type: text unformatted long)?

How can I avoid double line breaks (<br><br>) in a text field (field type: text unformatted, long)? Users write text into this text field. When they hit Enter twice, the result is: <br&...
-2
votes
0answers
27 views

webform feature compatible modules [closed]

can anyone suggest me which modules are used tracked webform submission data ,webform submission confirmation?my requirements are 1.want to convert the term ids for webform select lists mapped to ...
1
vote
0answers
30 views

A new field doesn't show on the page

I recovered a site from a backup which had run on Drupal 7.7. I upgraded it to Drupal 7.80 on another instance. Now, we need to add new fields to content types and add new nodes. I added a field as an ...
0
votes
1answer
16 views

Access a user entity reference in a commerce-product template file

I have a field_intervenantfield which contains a user entity reference. In the commerce-product template file, I want to access the description field of each intervenant. How can I achieve it? I tried ...
0
votes
0answers
16 views

How to get a product variant field (not attribute) value?

I have created a product variant with 1 attribute (say "Subscription Plan" or attribute_sub_plan) and 1 field (say "Number of Issues" or field_num_issues). The attribute was for ...
1
vote
1answer
31 views

Problem removing field collection module

We recently migrated successfully in our drupal 8 instance from field collection module (latest alpha) to paragraphs. Now I am trying to remove the field collection module from our drupal instance, ...
0
votes
1answer
30 views

Rules Custom Field

I am developing a Drupal site, where the administrator creates user accounts. Indeed for this site the administrator creates user accounts, he fills in the fields with the strict minimum (Last name, ...
0
votes
0answers
14 views

How to change form-text field maxlength / Translatation field?

I would like to increase maxlength of translation field. In database, field is VARCHAR (255) For translation version : maxlength = 128 I dont'know how to change maxlength for translation version. Is ...
0
votes
0answers
35 views

Error with creating custom fieldtype

I am creating a custom multi-value fieldtype for some functionality that I need. I have been using the drupal core 'telephone' module and the contrib 'address' module as reference, but am running into ...
1
vote
2answers
28 views

How to handle appendItem() when a list is full?

I'm creating a custom JSON:API Resource to store push notifications tokens. The user account field where the tokens are stored has a limit of 5 items. I am using appendItem() to add the value to field....
1
vote
1answer
35 views

Why put a different machine name for the same field?

I have an image field for my article content type with the machine name field_image I created a new type of content for cooking recipes. Should I use the existing image control or create an image ...
0
votes
0answers
19 views

Field difference plugin for referenced entities

We have a way to see diff for field changes/revision on paragraphs hosted on any entity, however does not look like we have similar functionality for Referenced Media Entities. Paragraph module seems ...
0
votes
0answers
18 views

Custom Submit Button On Inline Entity Form Triggers Gives Wrong Triggering Element

I have implemented hook_field_widget_form_alter() to add a new #process array item. E.g. hook_field_widget_form_alter() { $element['#process'][] = ['custom_process_function']; } This part works ...
-1
votes
0answers
13 views

View: Fields copy/reference each other when you add a separate display

So I have a normal page view with a handful of fields. Title, Price, ect. I wanted to create a Entity Reference page so I click add entity reference and it copies my current fields from my page view. ...
1
vote
1answer
69 views

How do I customize an entity's canonical page? [closed]

I have an entity called SyncJob and it contains the following fields: id progress: integer total: integer I need to customize its view page (canonical, not the collections one) to show the following ...
1
vote
0answers
27 views

How do I add fields to an existing custom entity? (repost) [duplicate]

I have a custom entity that isn't showing the ability to add fields. I need to add a field to it, and I want to do it through the UI. The entity was created in a custom module, which I can modify. How ...
0
votes
1answer
70 views

How do I add fields to an existing custom entity? [closed]

I have a custom entity that fieldable. I need to add a field to it, and I want to do it through the UI. The entity was created in a custom module, which I can modify. How can I make the entity ...
0
votes
0answers
45 views

How do I alter a bundle and programmatically add a form with a custom form mode?

I have created a custom entity type called custom_enitity and new bundle scores, using UI. Also got custom form display called score to add score via custom route. I keep getting the following error ...
0
votes
1answer
21 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 ...
0
votes
0answers
33 views

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

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 ...
3
votes
1answer
44 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
106 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
40 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
57 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
20 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 ...
0
votes
2answers
143 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
48 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
74 views

Undefined function 'entity_metadata_wrapper'

A custom module is using the following code. function sun_blogs_views_pre_render(&$view) { //...... $wrapper = entity_metadata_wrapper('node', $node); $title = $wrapper->...
0
votes
0answers
37 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
55 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
29 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
23 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
14 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
27 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
82 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
67 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
16 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
45 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
27 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
33 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 ...

1
2 3 4 5
172