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
7 views

Joining two text fields in a Computed Text field

I have two fields whose type is List (text). In the allowed values list, i want to join them. I used the following code. $value = $entity->field_a->value . $entity->field_b->value; $value =...
6
votes
1answer
2k views

Add Expression for Entity Query

I've been working with the entityQuery to query the db and get an array of filtered nids however I need to add an expression to my query. I've checked the Query class and found a protected sqlQuery ...
0
votes
4answers
2k views

How to use a block as a field?

I'm working with this module which is providing me a block for uploading the file as mentioned in the doc https://drupal.org/project/jquery_file_upload Is there a way, where I can use this block as a ...
0
votes
0answers
43 views

Programatically reorder referenced entities by field

I have a content type Speaker that uses an Event content type as reference. The Event has a start date and time field. There can be any number of events that a speaker speaks at, when visiting the ...
0
votes
0answers
16 views

Error on adding media entity browser [closed]

I've added some paragraph in my content type. In a paragraph, I've added another paragraph with some data, including a media inside another content type When I'm trying to add a media, I have this in ...
2
votes
1answer
2k views

How to expose filter for entity reference as dropdown in the Search API view?

In my Search API view, I'd like an Exposed filter > Entity reference to be a select box, not a text field. Details I have a view which I created like: Views > Add new view > Show: default node ...
1
vote
0answers
17 views

How accurate is the field list for estimating where fields are used?

I am trying to locate all places where a particular field is used. I am trying to see especially which all Views have required the field. I was planning to do a manual search using editor Find and ...
1
vote
1answer
963 views

How to calculate the average ratings for the post when the user submits 3 field ratings?

I need to implement ratings in my site. I have user five star rating and voting API module, I created a content_type with "beach", and created some field in the manage field settings, name, id, etc. ...
5
votes
5answers
5k views

How do I fix a "Mismatched entity and/or field definitions" error on my configuration?

I'm getting the following error on my Drupal 8 configuration page. Entity/field definitions Mismatched entity and/or field definitions The following changes were detected in the entity type and field ...
1
vote
1answer
920 views

Field widget item form alter for file field

I want to alter field widget item form of a file field with cardinality > 1 so that a new form element is added to each row of the file tables. For example, in the attached image, I want to add ...
0
votes
1answer
687 views

Simple webform with payment module

what I need do is not an ecommerce site. On my drupal website I need a simple web form with a payment (by paypal) and a node reference field prepopulated (by the entity refence and entity reference ...
2
votes
3answers
873 views

Loading taxonomy terms in a tree in Drupal 8

I have multiple level of vocabulary, I want to display all level in the hierarchy same as taxonomy display. My taxonomy is like. All Drinks Alcohol Drinks Beer Vodka ...
5
votes
1answer
103 views

What method should I use instead of Drupal\Core\Entity\Query\Sql\Query::addExpression()?

I am using Entity Query to select nodes of two different types. The fetching seems to be working, but I to sort the returned values. Both the content types have different date fields. I know I could ...
1
vote
1answer
1k views

Why I cannot get translated entities

I wrote service to get all necessary data for my page. Now I wanted to load them with translations. But whey I try, I got error: InvalidArgumentException: Invalid translation language (id of ...
0
votes
0answers
17 views

How do I unset an entity reference using JSON:API?

I can't figure out how to unset an entity reference when editing content via JSON:API. The JSON I use to create a new node looks like this: const myNodeToPost = { data: { type: '...
1
vote
1answer
393 views

PDOException : SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'registration

Using: commerce+entity registration+commerce registration During the checkout sequence, after completing the registration step, I get this fatal error: PDOException : SQLSTATE[23000]: Integrity ...
1
vote
1answer
954 views

How to add filters to a custom entity type listing page

I have a custom entity type and a list of entities of that types shown on a standard listing page. But I need to have some filters similar to what we have on a node list page How could I do that ?
-3
votes
0answers
23 views

Type does not correspond to an entity on this site [closed]

I developed some API's (with Drupal 8) but when I try to invoke it I got the following error "type does not correspond to an entity on this site." Do you know what about it?
1
vote
1answer
413 views

How to submit a field collection from a form into a created node

I would really appreciate if somebody could help me with this :) I have a field collection called field_formations. Inside it I have 2 fields: field_technologies - (reference to a taxonomy). ...
4
votes
8answers
9k views

How do I programmatically delete a reference field value?

I have a multi-valued taxonomy reference field named field_classrooms in a node type. I use below code to delete the value in the field. $node = Drupal\node\Entity\Node::load('1512'); unset($node->...
1
vote
1answer
39 views

Update FieldStorageConfig for a field in an update hook properly?

I need to update the allowed values option on an list_integer field. For reasons at the moment, I can't just update and export the configuration and import it on production until we implement ...
1
vote
1answer
1k views

Solr index fields not showing a field

I have a field within a field collection that I need indexed. It's not showing up in the /admin/config/search/search_api/index/solr_node_index/fields page. I tried using this to try to add it myself, ...
2
votes
2answers
559 views

Reference View in Entity Reference field

I have a content type that has an entity reference field allowing you to link to other pages and add a custom image, for nice big CTAs. However, it's come to light that some of the links may need to ...
0
votes
1answer
616 views

Issues with the title for a custom entity

I have a custom content entity in which I have defined all the fields in the annotation (and it shouldn't need to be altered through the UI in any way that I can think of). In the annotation I have ...
0
votes
1answer
1k views

What's wrong in my code for setting up entity title in a Computed Field?

I have written inside a Computed Field's Computed Code section the following code: <?php //work if the node is new and there is no value for the field yet if (empty($entity_field[0]['value'])) { ...
0
votes
1answer
1k views

Set value for start/end date field labels in hook_form_alter

how can I replace the labels of start/end date for a date field via form_alter? the code below only works for the fieldset. The "to" needs to be removed. $form['field_my_dates']['und']['0']['#title'] ...
0
votes
1answer
568 views

CCK checkbox or dropdown widget as a field?

I am trying to setup a new CCK field for a content type to display as a checkbox but I see I don't have that option in the widgets type. Shouldn't that be included in the default CCK? I am using the ...
1
vote
1answer
754 views

How to create a confirm popup when delete item with field collection?

I have configured a field collection field (unlimited items) for a content type and I want create a confirm popup when user delete an item. For this, i found that i can directly go and modify 2 ...
0
votes
0answers
17 views

Display machine name in entity_form_display_edit_form

The Entity Form Display edit form has a hidden field: 'hidden_name' => [ '#type' => 'hidden', '#default_value' => $field_name, '#attributes' => [ '...
0
votes
3answers
979 views

Organic Groups "create post" content link needed with posting content type specific to group

Organic groups 7.x-2.6 Entity reference prepopulate 7.x-1.5 Hello, I am trying to create custom "create posting" link for my organic groups. Each Organic Group has its own content posting content ...
2
votes
1answer
400 views

Entity field value

I have been creating some custom entities to Drupal 8 and they pretty much work as expected but a small thing of getting any value of a field. Lets say I have basefielddefinition like this: $fields['...
0
votes
4answers
2k views

How to run jquery codes before and after ajax call?

I want to create a loading code while the ajax call is not yet complete, AND enable my jquery code after calling the ajax of drupal form. The ajax I'm referring to is the "Add new field/Add more" of ...
0
votes
1answer
605 views

Getting a custom field to appear correctly in Rules using entity form module

I have written a custom field widget called foo which is inserted into an entity form to provide an autocomplete to another web service. I am trying to get the field data to be sent in an email via ...
2
votes
2answers
9k views

Right way to create Yes/No boolean fields [closed]

I want to add fields in my node which will contain boolean values only : Yes/No. Selecting boolean as field type will cause the field to show up as single check box and in the node edit form I've ...
6
votes
0answers
5k views

Mismatched entity and/or field definitions for comment field [duplicate]

I get this message Entity/field definitions Mismatched entity and/or field definitions The following changes were detected in the entity type and field definitions. Comment The Entity type field ...
0
votes
0answers
39 views

Can't get field storage definition in custom entity

I have a custom entity 'myentity' with some fields, and one of them is a taxonomy field with the next definition: $fields['colors'] = BaseFieldDefinition::create('entity_reference') -&...
3
votes
1answer
75 views

Details wanted for "Mismatched entity and/or field definitions" message on custom field

I have developed a custom Drupal field. All works fine. We are already using the field in production for a year. But the status report for exactly this field says: Mismatched entity and/or field ...
2
votes
2answers
54 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
1k views

Ajaxy entity reference views filter by entity reference view

I have two content types that share a taxonomy (Size). On content type A, I have an "entity reference" to content type B in the form of a checkbox widget. What I want: On the node creation form, ...
0
votes
2answers
51 views

How to make the float field accept decimal values?

I am using Drupal 7 and have a float field. It is used to enter prices. Most of prices I enter have decimals (e.g. 101.82, 99.88). Some of the prices are negative values (e.g. -55.52, -1009.88). ...
0
votes
3answers
1k views

How to get vocabularies for an entity reference to a taxonomy?

So I'm having a bit of a difficult time finding out how to get the information I want. I have an entity reference field - call it field_event_type. This is an entity reference to a taxonomy. I am ...
0
votes
1answer
1k views

How to get the count of referenced entity (by views entityreference result)?

For example, a student can register a class. The class node has a date field indicating whether the class is active for registering. The registration node has an entityreference field referencing to ...
0
votes
1answer
349 views

Time field not available

I'm trying to set up a CSV import to create nodes. On the Mapping page for the feed import, several of the fields in my target node type are not listed in the dropdown box to select as a target field. ...
2
votes
3answers
372 views

Hide default value by view mode

I have an image field inside the content type 'Article'. I have two view mode: "teaser" and "full". I have a view page ('Homepage') showing all 'Article' nodes using "teaser" view mode. In the '...
1
vote
2answers
2k views

Custom field widget form - Multiple values

I've create a custom field form widget for an entity reference field. When only one value is allowed it shows a (filtered) select list, but I want to allow user to assign multiple reference values to ...
1
vote
1answer
1k views

How can I retrieve the profile2 fields selected in a custom module?

I am totally new to entities in Drupal. I have used the Profile2 module to add a few profile types. This is displayed in the add/user screen as Customer. After adding the profile type I manage the ...
0
votes
1answer
932 views

Calendar widget link to list a day's events

I am using the Calendar module to manage an events calendar on a new site. Currently when you click on a day in the widget it takes the user to the calendar page that shows a small list of the titles. ...
2
votes
2answers
2k views

How to add UniqueField constraint on integer field?

The title basically says it all. I have the following field definition in an Entity class: $fields['code'] = BaseFieldDefinition::create('integer') ->setLabel(t('unique code')) -&...
0
votes
1answer
41 views

How can I programmatically delete a field value?

Using Entity API, I know how to get a value or to set a value : $nid = $entity->id(); $node = \Drupal::entityTypeManager()->getStorage('node')->load($nid); ... $nom = strtoupper($node->get(...
1
vote
3answers
1k views

How to dynamically pass a user field value to jQuery?

I have a notification bar with a counter, it actually prints the user's "notifications" field value (if it's greater than 0): <div id=container> <a href="#" class="activity_link">Activity&...

1
2 3 4 5
172