Stack Exchange Network

Stack Exchange network consists of 175 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."

2
votes
1answer
804 views

Changing decimal field scale and precision using database

I'm using a custom decimal field in a custom product type in Drupal commerce. It has a precision of 10 and a scale of 2 (2 digits to the right of the decimal place). I have a client with a large ...
2
votes
2answers
1k 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')) -&...
1
vote
1answer
939 views

Using Profile 2 with Entity Reference--How to display the user name and not the “Profile Name”

I've reviewed the threads similar to this, and can't seem to find a definitive answer. I have a Content Type in Drupal 7 where I want to be able to associate multiple users to a content item. For ...
3
votes
1answer
795 views

How to change the View Mode based on theme?

I am using the ThemeKey module to change the theme for mobile users. I have a custom View Mode called Mobile to display different content. I would like to have when my mobile theme is loaded for the ...
1
vote
1answer
1k views

How to get the node from the url referer?

I have a custom entity named Application that has an Entity Reference field named Product. When I am on an Apllication page and click on a Product to see it, I would like to know that I come from the ...
4
votes
1answer
1k views

Adding elements to a field widget

What I need to accomplish is adding a link to a node to field widgets (the node contains the formatted instructions to properly compile the field). The goal is something like this: "What is this?" is ...
3
votes
2answers
1k views

Related Content View with multiple Entity Reference Fields

I am trying to create a View to display related content based on shared taxonomy terms from multiple vocabularies. For example: I have two content types called Car and Parts. I have two ...
1
vote
2answers
2k views

Entity form with pre-populated entity reference from URL

I have two entities which are in a parent/child relationship. Now I want to add a operations link in the parent's list view so that I can show the child's entity form with the reference to the parent ...
1
vote
2answers
780 views

Feeds: Is it possible to set a unique field other than the title field?

I'm trying to create a feed importer that uses a unique ID that is NOT necessarily in the title field of the content type. For example, were I using the feeds importer to import a list of contacts, I'...
2
votes
1answer
22 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 ...
2
votes
2answers
1k views

Pseudo-fields and custom entity properties from additional schema

I'm trying to add property information to an entity which uses the entity API. Working from the commerce_product module I am trying to manage additional information outside of fields and in my own ...
0
votes
1answer
913 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
1answer
3k views

How do I remove the title field from a node's custom view mode

In my Drupal 8 website I created a custom view mode through the UI. I use it to output nodes using a view. In the view result I do not want the titles of the nodes to appear. The UI (content type > ...
1
vote
3answers
1k views

Add property to existing field type

I am having trouble adding a simple additional input (like 'alt' or 'title') to the image field type. In my .module file I defined an alternative class for the image field as follows: function ...
1
vote
1answer
2k views

How to add / update a field collection without updating parent node/entity?

I needed to to add / update field collections to node entities without updating the node entities. I tried two ways listed in https://www.drupal.org/node/1842304 and http://alexrayu.com/blog/...
1
vote
1answer
933 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'] ...
4
votes
3answers
7k views

Set datetime field and url in D8 programatically

I already asked a question like this (Set date field in D8). Ok duplicate entry? NO! Now i have also to set a time and i'm using a array. Another question is how to set a url in D8?! My code looks ...
0
votes
0answers
8 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 ...
10
votes
6answers
13k views

How do I remove the colon from my field labels?

I simply want to be able to remove the colon from my rendered field labels, for example: Hotel name: to Hotel name I copied field.tpl.php and removed the colon there, but no matter what Drupal ...
1
vote
1answer
400 views

How to use the same EntityListBuilder for entity A and an extended version B

I have used the content entity example coming from the example project. This example define a Contact entity. Next I have extended this Contact class in an Artist class with some added fields (let ...
0
votes
2answers
594 views

Render Date Range on node template

I'm trying to render both start and end date on a node template in Drupal 8 from the Date range field from the content type. I've tried multiple ways to no avail. -- Only shows start date -- {{ kint(...
7
votes
1answer
317 views

Show “Add more items” for fields of limited cardinality?

Is there a way to modify the behavior of a field that has limited input to do the 'add more items' button instead of show X fields on the screen? For instance, I have added a link field, that can ...
0
votes
2answers
933 views

How to output custom field of Content type in page.tpl.php?

I want to display a custom field which I created in my custom Drupal theme. The field I created called "Startnummer" so the machine name of the field (I didn't change it) was created as "...
1
vote
1answer
3k views

Render entity reference field with link in node template

I have a content type with an entity reference field to select a user. Now I would like to render this field in the node template so that the field links to the user profile. I set the format of the ...
2
votes
1answer
2k views

What may cause Column not found (nid) in on clause?

I'm using Drupal 7.14 and Entity API and Reference 1.0-rc3. And I'm also using i18n, entityreference (not References) and field_sql_storage. I get this error when saving a node that has some custom ...
0
votes
0answers
23 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
2answers
1k views

How do I update a user profile with entity_metadata_wrapper()?

I got an error while updating user profile data such as name,password and email. I am using entity_metadata_wrapper() for processing update. exception 'EntityMetadataWrapperException' with message '...
2
votes
3answers
919 views

How to count entity references from same field in different entity types?

I have three entity types: Company Team (has field_company which is an entity reference to Company) Employee (also has field_company, and field_team which is an optional entity reference to Team) ...
0
votes
1answer
345 views

SQL query to access a field collection's data? At them moment, I'm only getting field_collection_item returned

In the below example, I am trying to return the value of a field from all the field collections in the database but only get field_collection_item. This example is just the most basic field collection ...
-1
votes
0answers
28 views

Need to add more fields type for ECK bundle form drupal 8 [closed]

I need to add a range slider range field using hooks (or any other similar or easier way) in the ECK bundle form. Currently it lets me add the following basic types: What I really need is a module to ...
0
votes
1answer
17 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
2answers
781 views

How to add a custom field to a taxonomy term

I am developing a module and I would like to know how to add a field to a taxonomy term? My section is named special and I want to add terms in this section I have this code: function add($form,&...
0
votes
3answers
326 views

'Edit Own Content' permission missing in custom entity

I have generated a custom entity using Drupal Console. drupal generate:entity:content The entity doesn't have the permission edit own content which we usually have in node types etc... The entities ...
2
votes
2answers
1k views

Updating a module field schema

I'm currently working on a project created by someone else. I have a textfield called "city". Currently the maximum limit is 255 characters. I want to update the maximum character to be 100. Looking ...
40
votes
11answers
24k views

How do I remove a configuration object from the active configuration?

I'm writing a custom module for Drupal 8. It defines a field storage configuration object, in a file called modules/mymod/config/install/field.storage.bloom_stem.bs_twitter_ac.yml. The problem is ...
0
votes
0answers
21 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
1answer
658 views

How to filter entities in View by all of their taxonomy term reference fields?

Let's say I have a custom entity that has two taxonomy reference fields: categories and tags. And I want to display all entities that have taxonomy term with id 1. The term is a dynamic value(...
4
votes
3answers
2k views

How to display a comma-separated list of multiple field values?

How can I render for example each taxonomy terms value as an inline comma-separated list (or add between each of them a "/" Character) in my field template field--node--field-tags.html.twig file or ...
0
votes
0answers
17 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 ...
1
vote
1answer
2k views

Entity Reference View Widget problem with add selective

I am using a content type which uses a field as "Views" Entity Reference View Widget. When I click "add selective" or "add .. and close" in form of this widget, it's just redirect to http://localhost/...
0
votes
2answers
1k views

Mismatched entity and/or field definitions

I have no idea how to fix this, I don't even understand what the problem is. Mismatched entity and/or field definitions The following changes were detected in the entity type and field definitions. ...
3
votes
2answers
4k views

How do I display a field twice in a node's display?

In my full node display I want to show the same field twice, in a different mode each time. Specifically, I have a collection of images, I want one up top and the rest below in my already existing ...
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
29 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 ...
3
votes
4answers
2k views

How load only some node fields?

entity.query service is very handy when it comes to finding nodes with specific field values. Unfortunately all it returns are entity IDs and revision IDs. In case in which result set is big it's ...
0
votes
1answer
35 views

Referenced entities show old value when changing properties

I have three custom entities, all generated with Drupal Console. I only added some basicFieldDefinitions to them before testing some CRUD operations on them. I have these entities: ConfigEntity (...
0
votes
1answer
30 views

How Can I do a content type with a 1:n field inside?

I'm a bit lost about how Drupal manage content. For example, I want to create a new content type called Game. When I create a "Game" I want to introduce "Platform" and "Release date". For example: ...
0
votes
2answers
921 views

Views Table Grouping not working if group field is blank

I'm using Drupal 7. In a field collection view, I have data in a table that has field groups. I have 3 fields I want to group on, the first two are required, the third is optional. Everything worked ...
2
votes
1answer
696 views

Display field collection items by using twig

I'm using the field collection module in Drupal 8 to encapsulate event informations so I've got a field collection with six sub fields (place, starting time, etc.). In my twig template field--field-...
2
votes
3answers
849 views

How to hide specific term/field value on the node?

Is there a way to hide a specific taxonomy terms (specific field values) on the node? (not hiding field/vocabulary altogether, just some values). For instance, there is vocabulary "Location" with a ...