Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [entities]

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

-1
votes
0answers
7 views

Dynamic content entity reference

Our team is working on Drupal 8 project where most entities are created from code with Entity API, so-called Content Entities. We have two entities ExternalPerson and InternalPerson which are mostly ...
-2
votes
0answers
30 views

How to add new field to Node entity itself

I have site with a several views which displays multiple different content types. The results display a different (SVG) icon on them based on the content type. Which icon to display is done with a ...
1
vote
0answers
36 views

Custom template not used for custom entity generated with Drupal Console [on hold]

I have created a custom entity via drupal console, and it created template item_entity.html.twig in template folder, but the entity is being rendered in some other way because any changes in template ...
0
votes
0answers
14 views

Entity Refernce View Widget conflicting with Time Field?

am trying to setup a content type that has the need for both an Entity Reference Views Widget and also needs fields using Time Field (https://www.drupal.org/project/timefield), however the ERVW does ...
1
vote
1answer
19 views

How to create entity relation of counselor to client?

I'm trying to create a relation in D8 between a counselor and clients. The counselor would have to record counseling hours for each client. I've looked at the group module, even building the ...
0
votes
2answers
27 views

How to insert fields into a link field in twig?

We have several fields on our Article content type, one of which is a Link field. In a twig template we would like to display a <section> such that all of it is clickable with different fields ...
0
votes
0answers
19 views

Paragraph field titles showing even when set to visually hidden

I am using the following code to render a paragraph entity in a twig template: {{ content.entity_name}} A second template renders the paragraph's fields correctly using: <h2>{{ content....
0
votes
0answers
28 views

Export custom content type with fields

I want to export a newly created content type which has bunch of fields to a new application installation. Also I need to export few views etc... Exercise: I created a sandbox drupal 8 application. ...
0
votes
0answers
24 views

BAT or Entity module problem? [closed]

can you help me with this error: "Fatal error: Declaration of BatTypeController::save($entity) must be compatible with EntityAPIController::save($entity, ?DatabaseTransaction $transaction = NULL) in /...
0
votes
0answers
20 views

Pagination with entity

Don't know where to start and not sure if there is already some builtin functionality that can be used. I have an entity and items on the page are rendered with class ItemEntityListBuilder how can I ...
0
votes
1answer
57 views
+100

When adding media to content, how can I search for the media by tag or term?

In Drupal 8, I created a new Media type "PDF Files." I have imported almost 30,000 of them, each complete with Title (Name), file, and the taxonomy that categorizes them. On the content type (Let's ...
0
votes
2answers
24 views

Set value of file field using entity_metadata_wrapper non working

I have a custom entity with a file field accepting multiple values. I would like to set file values according to https://www.drupal.org/docs/7/api/entity-api/entity-metadata-wrappers#example-value-set-...
-1
votes
1answer
28 views

How do I delete options of a selection element? [closed]

I'm trying to remove some options from a selection form. I've tried several ways but nothing worked. I only need to delete the options which are being loaded in $disabled, a variable which contains ...
0
votes
1answer
18 views

Digit 2 Appended to Field Name on Column in Entity Field Query

I have an Entity Field Query that has fieldCondition for field_email ->fieldCondition('field_email', 'value', $email , '='); I have verified that this is the name of the field and I have other ...
1
vote
1answer
23 views

Viewing an image file breaks if view mode has responsive image style

I have an image file that I am viewing programmatically. When I set the image format to "responsive image" in file display settings, it breaks with an error Error: Call to a member function ...
2
votes
3answers
48 views

how to get all the fields that have been modified on entity save (form submit)?

I am trying to figure out an efficient way to get the fields names/values that have been updated. It's kind of similar to what the diff module does to calculate changed on a node but not as detailed. ...
0
votes
0answers
16 views

How to delete file entries on click of Remove button in file upload?

The orphaned entries of a file which is associated to the node should be removed when a file which is attached to a node is removed from it. Like associated entries from file_managed table. How to ...
0
votes
1answer
27 views

Views contextually filtered by terms in paragraphs

TL;DR, Below are the structure of content types, paragraph types and taxonomy in my site. Taxonomy vocabulary - Category Terms - Sports, Politics, Business Paragraph type - Multi Article Fields - ...
0
votes
0answers
44 views

Splitting routing.yml in multiple files [duplicate]

I have a my_module.routing.yml file and because of I have multi entity in my module its too big and not pretty. Is there any way to split it for each entity and include them in one file like symfony, ...
1
vote
2answers
48 views

How to know “keys” for Entity::create()

The document says Entity::create() takes "$values (optional) An array of values to set, keyed by property name" as an arguement. I also found snippets like $term = Term::create([ 'name' =&...
0
votes
1answer
26 views

Hook to trigger when a field collection item is being deleted

I have create a module and I am using the following hook implementation. The code works on success, but how do I prevent or stop further processing when I get failed as status? ...
0
votes
0answers
12 views

Adding menu of entity referenced links on a content-type page

I have this problem: I created content type named "DramaVoice" and "dramavoice" role. An user with this role can edit his own Dramavoice page, adding some demos and articles. I used entity reference ...
0
votes
2answers
108 views

Adding field collections programmatically

I'm trying to add a field collection to my user account on an event, and it seems to be being created properly, the fields are updated as expected and it parents it to the user account, however, even ...
0
votes
0answers
33 views

Grandchild Pathauto from Nodes

I have a node that has a parent_field (entity reference) that if left empty, that node is a parent. If parent_field has data (ie the nodes parent node name) then I can easily add pathauto in there ...
0
votes
0answers
13 views

Is it possible to delete or disable a set of entities via Migration plugin

Currently I have migrated a few taxonomy vocabulary entities whose source type is URL. These are migrated based on a flag. The flag value can change from time to time. The possible values are new/add/...
1
vote
0answers
26 views

entityQuery where a translation with a different value returns incorrect nodes

The title seems a bit odd, I know, but I couldn't find any issues similar to this and that's the best I could come up with. We are running into an odd instance of entityQuery returning nodes that ...
0
votes
1answer
32 views

How to access the properties in a config entity when loaded by entityTypeManager

Drupal 8 with custom config entity. I have a custom config entity that has various custom properties such as 'product_id'. I am loading the populated config entity like this: $config = $this->...
0
votes
1answer
16 views

File widget custom upload location

I am working on a custom module (based on Model project) with a file field attached to my custom entities, now I would like to save files in certain directories according to entity id eg: public://...
0
votes
1answer
17 views

define a template file for a field item in my modules

I wish to register a template file for use with a filed item, but I can't wrap my head around it. here is what I am trying to achieve. In my field widget Formatter public function viewElements(...
0
votes
1answer
20 views

Rule to create an identical entity to the node created then delete node

I have a content type called "article" and an entity type called "article 2", they both have identical fields. When I create an article node and save it I want a rule to fire that then basically ...
0
votes
1answer
16 views

Finding entity/webform fields in the database

A bunch of user accounts were deleted and recreated with new UIDs, and so any webform submissions or entities that have fields pointing to the old UID are now broken/wrong. I already updated some UID ...
1
vote
1answer
39 views

Set entity reference revision field value?

How do I set entity reference revision value for a field? I have two fields, field_test_entity_reference and field_test_entity_revision. field_test_entity_reference is of field type entity reference ...
0
votes
0answers
13 views

Entity reference Autocomplete widget performance issue on add/remove

I have created content type and using entity reference module.I am facing very slow performance on entity reference Autocomplete widget while add more or remove option in admin side. Its taking time ...
0
votes
1answer
24 views

Display entity as options_select multi-select

Below is my code for the view. I have tried multiple = true, multiple_values=true, multiple = multiple. None have worked. ->setDisplayOptions('form', [ 'type' => 'options_select', '...
0
votes
0answers
23 views

Implementing entity query to find/increment field values

Similar to this question but for Drupal 8, I have a custom node type with field_product_category and field_project_number. I want to increment project number based on a count of nodes with a specific ...
1
vote
2answers
51 views

Entity reference multi-select

I'm trying to make an entity reference field a multi-select options select but I can't seem to find out how to make that happen. Any help is appreciated. Below is the code I'm using. $fields['...
0
votes
0answers
15 views

How to load output an existing Commerce Line Item Type field in a custom form?

I need to output an existing Commerce Line Item Type field in a custom form and I can do this with a field from a standard Node but can't get it to work with Commerce Line Item types. The code ...
-2
votes
1answer
22 views

add an id to an element that doesn't have

So, I want to create an onclick event with javascript for each option of a "select form" when clicked, but since drupal doesn't use HTML I can't modify it manually and put an id to each. This is the ...
0
votes
0answers
13 views

How to use custom template in EntityListBuilder render method?

this is my render method from EntityListBuilder public function render() { $build['table'] = [ '#type' => 'table', '#header' => $this->buildHeader(), '#title' => $...
0
votes
1answer
21 views

Entityreference multiple choice

I have an entityreference field on users and I can't find a way to select more than one value. I want to make like a multiple select, but with the entityreference. I use the EntityReference module, ...
-1
votes
0answers
30 views

how to add constrain to form view in BaseFieldDefinition

I have this field: $fields['type_id'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Type of Item')) ->setSetting('target_type', 'type_entity') ->...
0
votes
1answer
24 views

Custom Entity: define a view in entity reference field

I defined a custom entity and for a entity reference field I want to set the view reference widget and a view/ display to be used instead of an autocomplete. I tried many different settings - nothing ...
0
votes
1answer
15 views

How to get field value after getting a node?

I have a content type which contains school information. School name and school id are two fields in the content type. I have the school ID and I am able to retrieve the node. How do I get the school ...
0
votes
1answer
40 views

Why is my update query OK for the database but the page shows the wrong value?

I have 2 custom content entities created with Drupal Console (drupal generate:entity:content): 'person' and 'member'. They are linked (1 member <-> n persons) by a field named 'member_id' in '...
-1
votes
0answers
40 views

Cannot db_select join extra taxonomy term

I have 4 taxonomy term fields with a total of 400 terms, and I have to query the input field from node/add reference field against the database. $query = db_select('entityform','e') ->fields('e'...
1
vote
1answer
27 views

Does the summary area support input filters?

I have noticed that text filters placed in the summary area don't seem to work, that the raw text appears in the summary info when posted in Twitter, Facebook and the like. Is that some inherent ...
1
vote
1answer
28 views

Use image field in an entity query condition

How to use image field in a condition of an entity query? To get X nodes which have no image as value of field_image I've tried this: $nids = \Drupal::entityQuery('node') ->condition('type','X') -...
0
votes
1answer
20 views

Add a view with a contextual filter not on a node/taxonomy page

Druapl 7 - I have a taxonomy vocabulary called ‘Destinations’ and an entity created called “accommodation”. The accommodation entity contains names of individual accommodations, to simplify, let’s use ...
0
votes
1answer
25 views

Conditional clauses with Entity field Query

I have a syntax issue on using conditional clauses with EFQ, but the documentation on drupal.org is a bit unclear for me. I have google the whole Internet for this with no results at all. My hook ...
0
votes
0answers
46 views

Always load additional data from referenced (child) entity

I created some custom entity types, let's call them "parent_entity_type" and "historic_data_entity_type". The parent entity type is referencing to historic_data_entity_type indicating which data is ...