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
2answers
30 views

How do I load entities with Null values?

The following fails with an exception. \Drupal::entityTypeManager()->getStorage('foo_module_division')->loadByProperties(['enabled'=>TRUE, 'parent_code'=> NULL]). How else do I specify I ...
-1
votes
0answers
23 views

How to fetch data from database using EntityQuery Drupal 8? [duplicate]

I need help. I am working on group module. I have group type named as drupalcamps. I have field in group type named as "field select theme" and also it make table in database named as ...
-2
votes
0answers
58 views

Why, the references to the entities do not disappear?

I have a site with Drupal 8.8.4 I created a type of paragraph with an "Entity reference" field which refers to the products and a "Date range" field : I created a type of store with "Entity ...
0
votes
1answer
16 views

Trying to list all articles where category field is empty

I have drupal 7 site and I'm trying to listing all articles (with title) and where category field is empty (taxonomy). I'm running this code in my page with ->isNull and without, but not any results. ...
0
votes
2answers
30 views

Given a taxonomy term id, how do we get the value of other fields; specifically the machine_id?

A good example of getting the children is posted How to get fields... I need the machine_id of the parent (or target) Code below fetches the name; $product_name_id = $product_name_reference->...
0
votes
0answers
16 views

Mailto ckeditor tool and image with link does not work together [closed]

Issue references : https://www.drupal.org/project/entity_embed/issues/3066494 https://www.drupal.org/project/anchor_link/issues/3065627 I need to provide a 'site building' way to add mailto links. ...
0
votes
1answer
24 views

How do I conditionally add a class to my page title within page-title.html.twig?

I have a boolean field within my Page content type called Hide Title. I need to conditionally add a class to h1's to visually hide them if this field is checked. I have the following within page-...
0
votes
0answers
5 views

Display only the variations of a specific product when I create a new content

I'm working on a videogame website. I use Drupal Commerce with Druapl 8 to manage games. For example : (Sonic the Hedgehog) is the Product, and (Mega Drive - EUR) and (Mega Drive - JPN) are the ...
0
votes
0answers
21 views

Is it possible to add “Options” to an User Reference

I have an Content Type called Account. My website Users are then linked to the Account entity using an Entity Reference field on the Account content type. I want to be able to assign different ...
0
votes
0answers
41 views

Why is my site status continuing to indicate mismatched field definitions after updating?

When I visit /admin/reports/status, I am told that a few entities have fields that need to be updated or reinstalled. I created an update hook: /** * Remove the result field from the analysis ...
0
votes
1answer
28 views

Create configuration storage programmattically for list_string

On a paragraph type, I have a field I want to migrate to a new field of type "list_string". To do that in the deployment and like our automatic deployment begin by an update of the database follow by ...
0
votes
1answer
38 views

how to pass a parameter to a route of type _entity_form

With some help I could create a route to an extended register form: as this form is an "entity form", my route have this type and the definition of this new form has been made in ...
1
vote
0answers
64 views

Getting granular data in template from an entity referenced in the entity_reference field, in a way that would respect Drupal's caching

I have a case where in my node's template I need an image style URL from the Media entity referenced by this node. I need a raw value of this URL to use it like that: <div style="background-image: ...
0
votes
0answers
33 views

Custom field with 'point' data type for storage

I created a new entity and added a few base fields using baseFieldDefinitions(). Everything works fine so far. The problem is that I would like on this entity to have a field with special storage ( ...
0
votes
0answers
33 views

How do I rename a field for an existing content entity type?

I created a content type, and I used it. /** * @ContentEntityType( * id = "program_permission", * label = @Translation("Program permissions storage"), * base_table = "program_permissions", ...
-2
votes
1answer
24 views

For Each, set element's title to some string

Hi I have made a custom module to alter the address module form. It works well for one field, however I am stuck trying to use a for each loop in recursively calling this to as many elements there are....
0
votes
0answers
46 views

Set display options for a json string in drupal 8 BaseFieldDefinition:

I have a field that stores a json string with keys and values in the database. I wish to format this output from my field definition display option to output the json string as a list. Is it possible ...
0
votes
0answers
11 views

View showing a list of tagged nodes related to term reference field

Drupal 7 Taxonomy vocabulary = Company activity (Activity 1, Activity 2, Activity 3 ….). This vocabulary has an OG group field. Content type 1 = Company with an entity (terms) reference field ...
0
votes
0answers
38 views

How to render a webform inside Entity form

My drupal system has the user entity with a field webform submission. The system has more than one webform also. What I need is, Whenever a new user came to register, the registration form needs to be ...
0
votes
1answer
38 views

How to display date and time picker for base field on custom entity

I've made a base field on a custom entity with type "datetime" using "datetime_default" for the form display. It's displaying as only a date picker, with no time component, whereas I want it to look ...
1
vote
1answer
26 views

Adding a base field definition in an update hook - it's not appearing

I want to add another base field to a Drupal entity. It used to be possible to just change the code for the entity definition and then update it via the Drupal console. But now it has to be done in an ...
0
votes
0answers
8 views

Entity reference add users autocomplete, autofill email in multiple fields

I have a D7 content node content type which has an entity reference users field with an autocomplete widget, addressfield. When I select an user the user entity and addressfield is automatically is ...
0
votes
0answers
13 views

Where to update revision translation affected?

In a custom entity I created I notice that when I view it's revision history it's mixed in with other language revisions. I noticed that node is making this check but figuring out if the ...
0
votes
0answers
22 views

Accessing the fields of a content via theme file in Drupal 8

I have a content type called vanilla spice and it has various fields. Afterward, I go ahead and create relevant content. How can I display parts of that content type in my homepage? In my themename....
0
votes
1answer
16 views

Accessing contents of a node id not working in .theme file

I have a page(node) with a certain ID. On the front page, I want to pull a field called field_image1 and field_link1. To do that I added the following to my themename.theme: function ...
0
votes
0answers
29 views

Migrate entity reference fields attached to a node or user entity

I'm trying to migrate content from drupal 7 to existing drupal 8 website. I created a custom module with configs to make custom migration. I have an entity reference field in drupal 7 referenced to ...
1
vote
0answers
26 views

Add CSS class to entity reference (taxonomy type) rendered as a field in a node

This is my first question on the forum. I am currently developing a site (Drupal 8.8.1). I am developing it in a sub directory on the server and not using Drush, the server belongs to a large academic ...
0
votes
0answers
58 views

EntityQuery for anonymous user

In my application I have a page that shows a view and a few fields from a node related to the view; this node is created when an authorized user accesses the page for the first time. When the node is ...
0
votes
0answers
20 views

Stop hook_entity_access early?

We're leveraging Permissions By Term to limit access to various content. We are hitting some performance issues, though, so I'm attempting to add a patch that allows/denies access to nodes given ...
-2
votes
1answer
47 views

How to use ajax in entity reference custom form to display no entity error in drupal 8?

I created a custom form on entity autocomplete called items like below, $form['items'] = array( '#title' => $this->t('Items'), '#type' => 'entity_autocomplete', '#target_type' => ...
0
votes
0answers
27 views

Cache Contexts in Entity Definition Doesnt seem to do anything

I have been using jsonapi to query my own custom entity and I've encountered a strange bug: When a user that has access to the entities does a get request at the json:api resource the results get ...
1
vote
0answers
26 views

Update field properties defined by hook_schema()

I'm probably a bit confused by documentation. Got a custom field with some properties defines in hook_schema() : /** * Some field type. * * @FieldType( * id = "field_selector", * label = @...
0
votes
0answers
19 views

How to change the 'target type' of an entity reference field?

I have an entity reference field that has existing data, which is populated by custom code. I now want to create a view of this data, but upon doing so have realised that the 'target type' of the ...
0
votes
0answers
36 views

Configuration Import Error

I have a drupal8 in local system. I want to import my production environment configurations into my local. So i am running drush cim -y I got the following error. Unexpected error during import ...
1
vote
1answer
40 views

EntityQuery does not return values

I am trying to get some entities using the "entity.query" service. What am I doing: in my module (file "mymodule.module") I execute: function mymodule_preprocess_page(&$variables) { $query = \...
0
votes
0answers
40 views

What kind of hook_entity can be trigerred by a migration on this entity?

I have a custom content entity on which I can run a dedicated migration from csv with a form. The form is used to upload the csv file launch the migration The submit part of the form: $fileId = ...
1
vote
1answer
63 views

Error while set a paragraph field to NULL during cron run

I am using Drupal 8 and I have implemented a hook_cron to set a node field to NULL. Here is my code: if ($lesson->field_lesson_ended_at->value < $current_time && $session_id &&...
1
vote
1answer
25 views

Large amount of entity revision cleaning leads to connection abortion

I am trying to remove revisions from each entity type which has the revision feature via drush command. The amount of entities are quite a lot: around 10K nodes, 2k paragraphs. On localhost ...
0
votes
1answer
24 views

How do you reorder an entity reference revisions field during hook_node_presave?

I am trying to reorder some paragraphs based on a text field within them on node save so the author does not need to maintain the alphabetical order manually, but when I save the node all values are ...
0
votes
1answer
42 views

How to save entity from a ajax form

I'm running Drupal 8.8.x The Problem Entity is not being saved when form is submitted through AJAX. Example: Build Form public function buildForm(array $form, FormStateInterface $form_state, ...
2
votes
1answer
45 views

Errors from custom FieldItemList::getConstraints() displayed next to every single property

Summary Errors set by constraints on custom field types appear next to every single property by default. We can use the ::errorElement() method on the widget to place errors that come from the ::...
-2
votes
1answer
56 views

Understanding “entity bundle” term

I understand it is commonly assumed that Drupal terminology about "entity" is inconsistent or at least tend to be unintuititve to non-drupal-programmers. As a non Drupal programmer I have asked here ...
0
votes
2answers
81 views

How to change field attributes of Content Entity?

In a custom module, I have a content entity in which I have defined this field: $fields['formheader'] = BaseFieldDefinition::create('string') ->setLabel(t('Header')) ->setSettings([ '...
2
votes
1answer
59 views

Don't repeat yourself: Natural place for clculations on the FieldItemList of a custom FieldType wanted [closed]

I have a custom field type that contains a number field, among others. class MyFieldItem extends FieldItemBase { public static function propertyDefinitions($field_definition) { $...
1
vote
2answers
144 views

How do you enable translation for a field which was defined by a contrib module?

I am trying to enable translation for a field which was defined by a different module. The problem is this field does not list in the UI. When I checked the definition for this field in ...
0
votes
1answer
63 views

Get url of referenced entity in twig based on target_id

I have a content type with a field « referenced entity » called field_suggestion_articles. User can choose related content and a view displays this list of related content at the bottom of the ...
0
votes
2answers
238 views

What is an entity in Drupal (at least for non Drupal-programmers)?

Assuming it is possible to understand what is a Drupal entity without knowledge and experience in coding with the main program-code of Drupal 8 (PHP), or rather without understanding relevant OOP ...
2
votes
1answer
28 views

How can I check to see differences across my multisites?

Currently, we're using Acquia Content Hub to syndicate content across our sites with a spoke and wheel syndication architecture. We essentially use a single site (that content editors use to create/...
1
vote
1answer
126 views

Is a custom entity type a content type, or can both at least be logically unified?

I am having a hard time understanding the term custom entity type. If it at all matters, I understood entity type itself to be a kind of "template" for content types. I became confused after reading ...
0
votes
2answers
48 views

Is there a way to get a value of a multi value field of an entity reference (reference a field value of a referenced term)?

I hope that maybe someone had a similar use case and has an idea how to solve it: I have content type that has an entity reference field to a vocabulary. With that I would like to achieve it to not ...

1
2 3 4 5
169