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
0answers
3 views

Paragraph's fields value loaded in a custom controller are in the default language instead of the current language

I made a custom controller that load a paragraph field from a node and then render some part in a template. The paragraph field field_title and field_description are translatable. The translation ...
-2
votes
0answers
22 views

One field dependent on another field Example

PHP 7.4/ Drupal 8.9.3 I went through the dependency example: https://www.drupal.org/docs/8/modules/business-rules/advanced-usage/dependent-field . Set it up step-by-step: Install Business Rules ...
0
votes
1answer
27 views

How to get the entity ID in a twig template

I have a custom entity, with the template my-custom-entity--my-entity.html.twig. How do I access the ID in the template? I can do this by implementing hook_preprocess_entity, but am wondering if the ...
4
votes
1answer
56 views

Load nodes by property, including empty ones

I want to render a node with certain properties set. For example, I want to load every node which ONLY has field_a and the other fields are empty. If I use $this->nodeStorage->loadByProperties(['...
1
vote
1answer
40 views

Using container element in form widget

I want to build a widget for a own field type. In the function formElement() of my widget I want the elements wrapped in a div. For this purpose exists the container element. So I build my form: ...
0
votes
0answers
25 views

The SQL storage cannot change the schema for an existing field (id in sms_phone_number_verification entity) with data

I am using the SMS Framework module and after updating my site from Drupal core 8.8.8 to Drupal Core 8.9.3 and the SMS Framework module from 8.x-1.3 to 8.x-2.0.0-alpha1, I start seeing the below error ...
0
votes
0answers
26 views

Access custom fields on account of current logged in user [duplicate]

I am trying to do something which seems like it would be pretty damn simple, yet I can't get to work; access a custom field (added via the UI at /admin/config/people/accounts/fields), for the current ...
2
votes
1answer
42 views

Getting latest entity data from the database

The problem: I open a drush php:cli shell and run the following: >>> \Drupal::entityTypeManager()->getStorage('paragraph')->load(477)->get('field_end_time')->getValue()[0]['value']...
0
votes
1answer
38 views

Generic field.html.twig template for a custom Entity

I have a custom Entity called custom_entity, along with a custom module which provides twig templates for my bundles and their fields. How can I define a generic/base field template for all fields ...
-1
votes
0answers
20 views

How do I trigger a custom AJAX event after a new entity has been created? [closed]

I am using EntityConnect contrib module 8.x-2.0-alpha2 on Drupal 8.9.x I have an ajax handler attached to a custom widget which is derived form EntityReferenceAutocompleteWidget. Ajax is triggered ...
0
votes
1answer
21 views

How to create block to list all children of an entity?

I want to list all the nodes that have the currently viewed node as their parent. To make this more tangible and less abstract, let's do an example: I have a content type Locations which has an ...
0
votes
2answers
43 views

How to programmatically associate a taxonomy term to a field

I'm trying to import user profiles data from a JSON file. Several fields are entity reference to vocabularies. I'm able to create a new taxonomy term entity in the universities vocabulary bundle ...
0
votes
0answers
11 views

How do you map a Salesforce master detail field to a field?

I have successfully mapped all fields except company name which is a master-detail field in Salesforce. This field is required to make a record in Salesforce. What field should be used to map to this ...
1
vote
0answers
38 views

Why is the output from getDefinition($type) different from getStorage($type)->getEntityType()?

In a Controller, when calling: $this->entityTypeManager()->getStorage($type)->getEntityType(), I do not have the exact same return value as: $this->entityTypeManager()->getDefinition($...
-1
votes
1answer
27 views

Checking whether an arbitrary field is valid for user entity

In my module I have a form where I want to give an admin the ability to configure which user field they want to put certain data in. In the context of the admin form, I'd like to verify that the field ...
-4
votes
0answers
10 views

Hook for dropdown field within config pages

In my config pages, I have embedded a paragraph type which in turn has two fields. I want to write a hook for a dropdown field within the paragraph type , where I can show and hide other fields for eg ...
-1
votes
0answers
18 views

How do you set what to show in the field select list of a custom entity?

I'm trying to set up a Drupal 8 site connected to Akeneo pim with Drupaneo. The module create a product entity and when I try to acces those product with a field entity reference the select list is ...
-3
votes
0answers
21 views

CSS issue with module Entity Print

I install and activate entity print on my Drupal 8 website. I create a theme entity-print--node--produit.html.twig in my subtheme/template/node. {% set node = content[0].0["#node"] %} &...
1
vote
1answer
20 views

Exclude entities currently referenced on a node with entity browser

I have content type that references a custom entity and uses an entity browser widget to select them. I want to create a view for the entity browser that excludes entities that have already been ...
0
votes
0answers
47 views

hook_entity_predelete never called

I have tried to create a hook that deletes an entity of type notification when the entity of type deadline is deleted, but the hook never gets called. Entities of type notification have one referenced ...
-1
votes
0answers
34 views

Add custom text field in Link field type

How to add custom numeric text field to the link field type. currently it has URL and Text field, need to add one more field. Found the way to add it using Field Widget but exactly not found the ...
0
votes
0answers
13 views

Unable to add field in administer field tab

I am trying to add fields in Drupal 8 to a existing entitiy. The "administer field" tab is visible but the button for adding fields is missing there. The button is also missing when creating ...
0
votes
0answers
39 views

How do I migrate node entity references?

I would like to migrate node entity references from D7 to D8. In my D7 application, many nodes are related to other with the "entity reference" system. But related nodes could belong to many ...
2
votes
1answer
34 views

How to render a node on behalf of another user (as an admin or without accessCheck)

Context : I use the following code to replace a token by a rendered node. The resulted text is sent by email $renderable = $view_builder->view($node, 'token', $langcode); $replacements[$original] = ...
0
votes
0answers
10 views

default image not showing

I have a entity reference setup in a block that uses the media gallery. I'm trying to get the default image to work which currently if I upload image and it shows but the default image doesn't show if ...
0
votes
1answer
14 views

Entitybrower access denied for non-admin user

I have created an entity browser for taxonomy terms that is used as an entity reference select form element on a node. This allows users to browse terms grouped by vocabulary, see synonyms etc. The ...
0
votes
0answers
11 views

8 Field autocomplete hook [duplicate]

Is there a hook available to modify / alter the title of content in this list ? It's a autocomplete widget. I just want to add the content type.
1
vote
1answer
34 views

How to programmatically reference entities?

I am trying to reference an entity within my hook, so that every time a new entity is inserted, I create another entity referencing the first entity. I have not yet found a working way to reference an ...
0
votes
0answers
20 views

Incorrect field of a content type in its display after migrating from a backup

The following two screen shots should explain the issue well: Here I have a content type Poll, where the first field is Question with machine name title. However, in Managage Display tab, the second ...
0
votes
2answers
21 views

How do I add a filter to a checkbox list in a content editing form

I have a taxonomy select field within a node form (7). I've chosen checkboxes and it is hard to scan them. I'd like to be able to add a filter so that the user can enter text to limit the number of ...
0
votes
2answers
66 views

How to create new entity within a hook?

I am trying to create a hook that creates a new entity('Notification') when an entity of another type is created (either of type 'Deadline' or 'Message'), but I can't seem to figure out how to add a ...
0
votes
0answers
12 views

getting custom field values

I set up a content type of example with custom fields. How can I get the field values to show in my twig template? I have tried {{ content.field_formattext‎ }} and that doesn't display anything.
0
votes
0answers
11 views

View with referenced nodes from field in the same paragraph possible?

I can not seem to figure out how to set up the correct contextual and relationship settings to accomplish the following: I have a node with a paragraph named slides. In the paragraph slides there is ...
0
votes
1answer
13 views

How do I set up an entityreference entity base field to show as a link to the target entity?

I have a base field on my entity type that's an entity reference, e.g.: $fields['type'] = BaseFieldDefinition::create('entity_reference') How do I set this up so it displays as a link to the ...
0
votes
1answer
16 views

Add extra custom permissions to Field Permissions

I'm using Field Permissions module to restrict access to each field. If you choose custom permission on /admin/structure/types/manage/CONTENT_TYPE/fields/FIELD_NAME, you'll see these permissions are ...
0
votes
0answers
20 views

Bug in setError when using unlimited cardinality with custom FieldType

I have recently added the field_example (Color RGB) custom field type to my Drupal instance (Drupal version is 8.9.1), didn't make any changes to the example code, and found that when using unlimited ...
0
votes
0answers
11 views

Entity where member variable is different type than when serialized

Not entirely sure how to phrase this. I've got a config entity that needs to store a block id. In my config I have the mapping set to a string for the id. When I load the entity, I'd think it would be ...
0
votes
1answer
31 views

Confused about Entity bundles

I'm trying to convert a Drupal 7 site to Drupal 9 before D7 reaches EOL, and I had a custom module that had a lot of custom tables defined in Hook Schema, that would be joined together in different ...
0
votes
1answer
50 views

The “dictionary_term” entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition()

I followed How to create a custom entity in Drupal 8 to create a module. When I installed it, I got the following error. Drupal\Component\Plugin\Exception\PluginNotFoundException: The "...
0
votes
0answers
26 views

In which scenarios should i create a custom entity (content or config) rather than using content type? [duplicate]

I have always this question in mind, what are the perfect scenarios to create custom entity rather than using existing Drupal's entities ?
1
vote
1answer
22 views

Non-Config Menus

I have this requirement where I would need to create a menu every time a user creates a new instance of a custom entity I'm building. One can easily do this with Menu::create() on entity creation, but ...
0
votes
0answers
39 views

How to create a term reference field programmatically

I need to add a taxonomy reference field to a node bundle, programmatically. I found a couple examples here, but one actually is incorrectly titled and is about creating a from field for it, and the ...
0
votes
1answer
32 views

Override remove entities link on module uninstall page

When a module needs to be uninstalled, Drupal adds links indicating there is content associated with the module which should be deleted first and provides a link Remove module_name entities. This ...
0
votes
1answer
13 views

Dynamically add destination fields to migration - importing data when fields on destination entity are not know

I am trying to import content from JSON from an API call. This API call has different source data depending on what the call is. For my migration from this JSON, there are set fields that I have coded ...
0
votes
1answer
48 views

How do I display an array of entities from a controller?

I am new on Drupal 8 , so i have created a service class which return a list of data, 'articles' (node entities), and I call this service class inside a controller, but no data showing up : My ...
0
votes
0answers
47 views

What is the purpose of the Manage Display in Content type?

For example, in the Body field there is a LABEL with the following values: And there is FORMAT with such values: How does something change on the site depending on the selected values in the Manage ...
0
votes
1answer
32 views

Query remaining field names from a database table

There's a database table. I know only one field name on the database table: username. How do I view remaining field names on the table? namespace Drupal\fixx_helper\Controller; use Drupal\Core\...
1
vote
0answers
22 views

How can I access all of the inline entities in a custom inline entity form validation?

I have a registration form with inline participant entities like this: I'd like to add a custom validation that prevents duplicate email addresses for the participants. In the example above, the user ...
0
votes
0answers
6 views

Field Record not being deleted when entity record is deleted

We are writing some end-to-end tests using Cypress and have run into a weird issue where one of our custom field records does not get deleted from the field table when the entity get's deleted. The ...
1
vote
1answer
44 views

Filter the list of entities referenced by “Entity reference revisions” field

I have a content type "Slider" which uses an Entity reference revisions field named "Slides" to save reference to various paragraphs that are then displayed on the frontend as a ...

1
2 3 4 5
170