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
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 ...
62
votes
9answers
119k views

How do I access a field value for an entity (e.g. node) object?

node_load((int) $nid) loads a fully-populated node entity. $node->title->value gets the title, but how do I access field values in Drupal 8?
2
votes
1answer
123 views

Additional field settings without creating a new field type

I'm trying to add 2 options to the field settings of all fields of a particular field type, in this case file field. To add the fields to the form I'm using mymodule_field_config_edit_form_alter() ...
0
votes
1answer
819 views

How to render entity reference data in field template?

I have a field collection with adding multiple items. In each item there is an entity reference field with multi-selection of contents. I can render entity reference content by target_id using ...
1
vote
2answers
798 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'...
4
votes
1answer
108 views

Custom theme: variable not made available in menu template

I've created a custom theme, let's call it "mytheme" in the examples, with the "classy" theme as base. I use several templates, one is menu--account.html.twig, it's an override I made of the classy ...
5
votes
1answer
2k views

How do I get a list of bundles?

In Drupal 8 how do I programmatically get a list of bundles for an entity type, for example the list of content types. Specifically, I'm looking for the machine names.
4
votes
2answers
1k views

How do I filter by node ID in views?

I am trying to add Node ID in contextual filters but it seems there isn't Node ID anymore.
3
votes
1answer
402 views

Why does loadMultiple load 1000 nodes 9.2 times faster than loading each node one by one?

I have always known that loading multiple nodes at the same time is faster than loading nodes one by one. What I wasn't aware of, is the huge performance difference between the two ways of loading ...
0
votes
2answers
2k views

creating child terms from a parent using fields

For a project i would like to achieve the following: Using 2 fields in a content type field_parent = reference to term This field references to vocabulary 'parent terms' I have a second field ...
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 ...
1
vote
2answers
1k views

how to render a node field of a referenced node on the node form

I'm using Display Suite to show a referenced node inside another node in the default display. But when I edit this node that has the entity reference field on it, it shows me the reference field and I'...
0
votes
0answers
11 views

Cant get Quick Edit Link to display on Published Content

I am having a problem with the Quick edit link displaying on published content? Is this working as designed or am I missing something. The quick Edit link appears on all of the unpublished content. ...
1
vote
1answer
436 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 ...
1
vote
3answers
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 '...
1
vote
1answer
2k 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 ...
0
votes
1answer
924 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
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')) -&...
0
votes
1answer
144 views

How do i get views field labels in the template file

I am creating a view, and displaying view by using custom template files. As per theme suggestions I named the template file for fields as views-view-fields--blog-display--page.tpl. In this file I ...
0
votes
2answers
461 views

How do I change the field format? [on hold]

I have a view (page display) with few fields. I want to change one field's format to HTML markup. How can I do it programmatically by using hook_views_pre_render() or perhaps any other hook_?
1
vote
2answers
3k views

“Uncaught TypeError: Cannot read property 'getAttribute' of undefined”

There are some posts about this error for Drupal 7, but I'm using Drupal 8.1 and those solutions don't work for D8. I tried this patch (coded for D7) and doesn't work. The effect of the error is ...
0
votes
2answers
804 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(...
3
votes
1answer
804 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 ...
2
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
1k views

Add property to existing field type

I have troubles adding a simple additional properties (like alt or title) to the image field type. In the .module file I defined an alternative class for the image field. function ...
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 ...
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 ...
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
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
0answers
38 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 ...
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
0answers
29 views

Change field type for custom entity (from integer to decimal) with existing data

Yes I have seen previous answers about that, but I'm looking for an new answer : That does not use SQL request That does not use deprecated function like db_change_field() maybe that uses the new ...
1
vote
1answer
345 views

field_info_field: how to define the content type name?

I defined several content type. In a module, I need to get the list of fields for this content type. I did the following: $fields = array(); $content_type = 'indicatorsheet_page'; $instances = ...
2
votes
3answers
945 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
25 views

Reuse/sync view mode display settings across entity bundles?

Assuming I have a number of entity bundles (e.g. node types) with a similar structure and behavior. Now I want to show a list of such entities/nodes. I want to use a view mode, e.g. "teaser", to ...
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
3answers
1k views

Changing the view mode of EntityReferenceFieldItems programmatically

I have a paragraph (I'm using the Paragraphs module) that contains an entity reference field that contains references to other pages. The display settings are set to use a particular view mode, e.g. ...
-1
votes
1answer
389 views

Quick edit module on user entity doesn't seem to be working [on hold]

I try to use the quick edit inline on user entity and it doesn't work. Can't see the small pen to quick edit when hover the user content. Works fine for node entity. Didn't find any issues about that,...
0
votes
0answers
12 views

Can't add sub tab local tasks to admin/content/my_entity

I have a custom content entity list which has its own tab into admin/content/my_entity. The content of this tab is generated by using EntityListBuilder class. Actually, I created it with the drupal ...
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
2answers
960 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
2answers
26 views

Default value for datetime field definition in content entity?

I have the following datetime field definition for my content entity: $fields['start_date'] = BaseFieldDefinition::create('datetime') ->setLabel(t('Start date')) ->setDescription(t('Start ...
0
votes
2answers
2k 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. ...
0
votes
1answer
13 views

How can I make entityQuery('commerce_order') return completed orders?

Under Drupal Commerce 8.x-2.13 I find that the query Drupal::entityQuery('commerce_order') with no conditions attached returns ONLY incomplete orders (when called in the context of an API endpoint)...
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 ...
0
votes
1answer
668 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(...
1
vote
1answer
391 views

hook_inline_entity_form_table_fields_alter add custom field

Need some help with Inline Entity Form hook function hook_inline_entity_form_table_fields_alter. I'm trying to add columns to the table that is visible when editing a specific node. I have been able ...
0
votes
2answers
359 views

Linked entity references in a content type

I am unsure if this is possible in Drupal 7, but here is my problem: I have 3 content types, A, B and C. B and C refer to A through a field field_A (entity reference). C refer to B through a field ...
0
votes
1answer
365 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
vote
1answer
464 views

Deleting field revisions directly from the database

With full recognition that this is not considered a best practice (and is generally considered a worst practice) does anyone know if it is safe to delete field revisions directly from the DB via a ...