Questions tagged [entities]

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

0
votes
0answers
12 views

How to reference current user when creating taxonomy term

Using drupal 8.7.x I'm trying to create a vocabulary that references the user that creates the term The settings of the user reference field are the following. The taxonomy term is created using a ...
0
votes
0answers
33 views

Is it possible to make a site aware of entity schema changes that are managed externally using SQL-based storage?

Consider the following situation: A Drupal 8 site using native SQL-storage (MySQL) custom_table is added to the same MySQL host as Drupal, either as a table in the Drupal system DB or as a table in a ...
0
votes
1answer
44 views

Mismatched entity and/or field definitions - 8.7.1

I have updated the Drupal core from 8.6.4 to 8.7.1 using pantheon. Once I updated the core, Mismatched entity and/or field definitions errors are showing in status report. (Refer the screenshot) I ...
3
votes
2answers
365 views

Safe and elegant way to access nested entities via fields

I've seen a variety of approaches to access entity values in the theming layer. The code below is just a simple example using magic methods. It assumes all values are set - if any part of that returns ...
1
vote
0answers
15 views

how to update FieldStorageDefinition in a hook update?

This is a feeds module related issue. An entity update that started to cause errors on 8.7.x after the removal of automatic entity update. Originally an entity definition needed to be updated using ...
0
votes
1answer
20 views

How to get taxonomy term values?

In my user entity, I have a term reference. In that vocabulary, I have a regular field. How can I fetch that field's value? I tried the below in devel/php to no avail. $user = Drupal\user\Entity\...
0
votes
0answers
8 views

Missing is empty operator on custom entity views integration

I have a custom entity called measurement. There is a baseFieldDefinition field called completed. When I am creating a view for this custom entity, I want to add a filter to the view so that only ...
0
votes
0answers
14 views

Entity print module. How to create TOC?

I'm using entity print module and wkhtmltopdf library. Even though I've checked the create table of contents on the configuration, I don't know how to do that. I've created h1, h2 and h3 but the TOC ...
0
votes
1answer
15 views

Why is data-quickedit-entity being printed in plain text when I'm signed in?

I have a template for theming paragraph sections that, for some reason, prints out data-quickedit-entity-id="paragraph/2" in plaintext above any of my paragraphs that contain images. {% set bgcolor = ...
0
votes
2answers
30 views

How do I get a plaintext list of tags from a multi value entity reference field?

I have a module that's making custom RSS feeds for me. In a content type, I have my tags stored in "field_tags" entity reference field. My goal is to get the names of all the tags, and ultimately ...
0
votes
1answer
29 views

Content entity doesn't load on edit

I have a custom entity, BaseEstablishment which is an abstract base class, implemented by Practice. abstract class BaseEstablishment extends ContentEntityBase implements EntityOwnerInterface { // ...
0
votes
0answers
12 views

Setting default value to custom fields in menu items

I created a custom boolean field in my menu item using this hook_entity_base_field_info function Mymodule_entity_base_field_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) { if ($...
1
vote
1answer
34 views

Alter user's entity label method

By default the label() method of the user entity returns the username. So everywhere on the website where user references are used, the username is displayed. I need to alter this method so ...
-1
votes
0answers
9 views

Entity Reference Filter: Filter users custom field

I have created content type which has various fields. One of its field showing list of users in the system as an select box (option to select user). I want to filter that list of users(people) based ...
0
votes
0answers
39 views

Change table_name in Content Entity

In Drupal 8 I have an entititype that I want to save to a different database i.e. not the default. I found this post on Drupal Answers, that seems to offer a solution. I'm not sure how to implement it....
-2
votes
1answer
23 views

How to restrict/provide access to particular entities of some ENTITY_TYPE to users which has email listed as field value?

I have a entity type Products with multiple entities in it. I want to give View, Edit, Delete Access of each entity to users only whose Emails are listed under field_user_email. I want to restrict ...
0
votes
1answer
43 views

Get node data from entity reference field

I have an entity reference field to a content type blog. I referenced a specific blog, but when I render that field in twig using {{ content.field_blog }}. I want to get the autor name and time when ...
0
votes
1answer
14 views

Programatically copy an image from user entity to webform submission entity [closed]

Using a custom webform handler, I am trying to copy an image from the image field (field_usr_avatar_img) located at the user account page to the image element (avatar_img) located at the webform ...
0
votes
0answers
23 views

Service decorator for entity list builder?

Is it possible to use a service decorator, or similar mechanism, to override a method in an entity's list builder? For my specific use case, I want to override the render() method of the Drupal\...
0
votes
1answer
46 views

How to print the relative url or node id for each referenced node in twig?

I am using paragraphs to render a number of nodes on a page. The nodes are obtained through an entity reference field called 'field_nodeslist' in my cards paragraph type. The cards are then rendered ...
0
votes
1answer
29 views

Provide autocomplete field with user's Display Name

Drupal core already supports autocompletion of username fields. However is there a way to provide autocomplete for user's Display Name? Since this is a virtual field, a database query with % like ...
1
vote
1answer
44 views

In code, only create a revision if a field is changed

I have a custom revisionable entity with a few dozen fields. I'm importing data about the entity on a periodic basis. If the entity has changed, I'd like to save it and create a new revision. $dogs =...
0
votes
1answer
45 views

Entity getOwner()

In what table does an entity "foo" get its metadata stored? In Drupal 7, there are tables for all the fields for a content type and the node table had some metadata stored, but most data for a content ...
0
votes
1answer
14 views

How do I change the Views (Entity Reference) filter via AJAX?

I have an entity form that allows an admin to select a content type (checkbox) and an autocomplete field that is tapped into a VIEWS Entity Reference (via the Reference Method). Goal: What I would ...
0
votes
1answer
157 views

How do I perform outstanding entity updates after 8.7?

I have just tested the update to 8.7.1 (from 8.6.x) which includes the removal of the old automatic entity update functionality, which means drush entup no longer works. As far as I understand the ...
0
votes
0answers
8 views

How to compute field value of another content type using compute field module?

I have two content types. Let's call them "A" and "B". A has nodes with field_cost B has nodes with field_total_cost Content type A has a field_costumer which is referenced to the entity of Content ...
1
vote
1answer
19 views

Refreshing entity definition

I've got a D8 media type that holds information obtained from an external source. The information comes in name value pairs that I wish to save as individual fields, mostly so I can index them easily ...
0
votes
2answers
30 views

Search Nodes by reference field target ID

I have a Node by the Project bundle name. Each Project has a reference field to another entity by the name of Contact, that this contact entity has the Client bundle. I can get the Client target ID ...
0
votes
0answers
20 views

I accidentally deleted basic_cart_vat, there's a way to a restore this field?

I accidentally deleted the field basic_cart_vat from Orders, now I'm receiving an error because I don't have the field. InvalidArgumentException: Field basic_cart_vat is unknown. in Drupal\Core\...
0
votes
2answers
19 views

Create a view on a entity using criteria on another entity

I'm trying to this done : I have two entities 1) Listing Details 2) Listing Premium Settings. This entity references the first Listing Details entity. In the second Entity I have referenced entity ...
1
vote
0answers
42 views

Error when saving node with submit callback added in form alter

Scenario: I am building a Multistep Wizard for two different content type. Magazine Information Magazine Details On 1st Node I have by Default, Save/Submit Button Available. Now i want to add "Save ...
0
votes
0answers
13 views

How to get the value of a date field in Drupal 8? [duplicate]

I know how to get the value of a field using the code below :- $entity->get('field_name')->getValue(); But how to get the value if the field type is "date"?
0
votes
1answer
50 views

How can I get all fields and values of a node at once?

I know how to get a particular field (title field) of a node by following code: $publications = \Drupal::entityManager()->getStorage('node')->load($node_id); $title = $publications->getTitle(...
0
votes
1answer
212 views

Running drush entity:updates claimed successful but not changing anything

I am working on a project with custom entity type. My module works fine in my local environment. But when I deployed to my staging site, things are strange. For instance, I tried to change my entity ...
-3
votes
1answer
90 views

Getting an error while updating core to version 8.7.0

When update Drupal 8.6 to 8.7 getting the following error. Anyone help would be appreciated. TypeError: Argument 3 passed to Drupal\views\EntityViewsData::mapFieldDefinition() must implement ...
0
votes
0answers
19 views

Data storage for custom config-entity sequence type

Using Drupal 8 I've got a custom content type application and a ConfigEntityType application_type for bundles of it. I need each bundle to store a list of strings when newly created/edited. E.g. ...
0
votes
0answers
11 views

geofield map Custom Marker by Entity Reference

have a project node that has google map and also entity reference as fields, I want to know is there any way to customize the google map markers according to reference fields data? For example, I have ...
0
votes
1answer
33 views

How do I know what setSetting is suppose to be?

I am creating a custom content entity and in the BaseFieldDefinitions, I am trying to create a field for assigning a user as the designated assigner and will follow up with a assignee. So far, the ...
0
votes
0answers
24 views

How to handle submit of a form that extends RegisterForm?

I have a form that extends the native RegisterForm When this form is submitted, I would like to register a user, but then I would also like to store the uuid & certain fields like name & ...
0
votes
1answer
27 views

How do you populate existing entities with the default value for a newly added field?

Let's say I have a content type, Article, with several fields. I already have hundreds of Article nodes created, but now I want to add a new field. After I set a default value for this field, how can ...
0
votes
1answer
18 views

How to use a token in the reference fields

1-I have a node with the name of the project. 2-this node has a project_name field that generates by these Tokens 3- I have a reference field that it load an entity type in the project create the ...
1
vote
0answers
18 views

IEF reference show parent field as title using Auto Entity Label

I am new to Drupal 8 want to add a field value to IEF reference title. for now, I am using Auto Entity Label version 2.x-dev to automatically generate a title for my Entities but when it comes to IEF ...
2
votes
1answer
25 views

Is there a generic method to retrieve entity IDs?

I have seen this code suggesting how to return a list of entity IDs: $query = \Drupal::entityQuery('node'); $query->condition('type', $bundle); $entity_ids = $query->execute(); but this ...
0
votes
0answers
14 views

Programmatically add field collection item (child) into a existing field collection item (parent)

I have a nested field collection item, field_collection_parent which contains one field_text and a field collection field_collection_child contains two text fields(field_a and field_b). Now I'm ...
0
votes
0answers
24 views

Use autocomplete with an infinite cardinality

I am trying to attach a list of users to a new entity I am creating. I want to enable autocomplete on those fields but I can't get it to work. For the moment, my field looks like this : array( ...
0
votes
1answer
34 views

Display multi-value entity reference field in node edit form as draggable?

Is there a way to display a multi-value entity reference field as a draggable widget in a node edit form? I'm looking for the exact same behavior that a multi-value image field has by default. I would ...
0
votes
0answers
76 views

Updating a module results in a Mismatched entity and/or field definitions with live server only

Installing updates produces Mismatched entity and/or field definitions, yet only within the live server instance. Local environment works as expected. It first happened with the update 8001 in both ...
0
votes
0answers
18 views

no default store (drupal commerce 1.x)

Is there a way to adjust or add the "default store" value directly in a SQL table? I have no default store listed - if it is applicable to version 1.x and all the products I imported from Ubercart ...
0
votes
0answers
23 views

How to install the module Entity Browser?

I'm trying to install the Entity Browser module, but I'm getting this error: It basically says that the "entity_browser" entity type does not exist, and based on the error I tried to install the ...
0
votes
0answers
33 views

How can I replace static file and media links in content with their equivalent entity references?

I imported content from another system. So, for example, the body has typical html, like this: <img src="/images/image.jpg /> All of the media assets that are referenced as static html, those ...