Questions tagged [entities]

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

Filter by
Sorted by
Tagged with
1
vote
2answers
1k views

Find entity id in database

I am currently moving a website from Drupal. The information I need to transfer is divided to many DB tables and connected through entity_id (That is my understanding, I have no experience in Drupal). ...
1
vote
1answer
519 views

How do I attach an existing file to a node?

Here's my problem. I have a D6 site which has been in production for a number of years, and in consequence has used various methods (and modules) for displaying images within body text of book pages. ...
0
votes
0answers
8 views

How do I add a reference to a parent entity when I create new subentity

I have two Entities: quiz and question. The quiz has an entity_reference field questions. I have a page /quizzes/{quiz}/questions that links to a "Add Question" page /quizzes/{quiz}/questions/add ...
1
vote
1answer
465 views

default value imagefield -> get from field collection item

I've got a contenttype "gallery" with an imagefield "thumbnail", used in listviews oder teaserviews. This contenttype also has a field collection with "image", "title" and "description". So what would ...
0
votes
0answers
14 views

How to reference current user when creating taxonomy term

Using drupal 8.7.x I'm trying to create a vocabulary that references the user that creates the term The settings of the user reference field are the following. The taxonomy term is created using a ...
0
votes
1answer
480 views

How can i add our own field in Ubercart billing address?

I have used Ubercart in my project. I would like to add my own one field in Ubercart Address field. How can I? Does any one had same experience?
1
vote
3answers
1k views

Field collection translation

My site has a number of content types that have Field Collection fields. All of these field collection fields allow more than one value. I've marked the content types as translatable, and the field ...
3
votes
1answer
1k views

Is there any documentation for the UUID module?

I think I need to utilize the UUID module to make universal ID's for some taxonomy terms. However, after installing the module it doesn't seem to do anything and the configuration interface has only ...
0
votes
0answers
50 views

Is it possible to make a site aware of entity schema changes that are managed externally using SQL-based storage?

Consider the following situation: A Drupal 8 site using native SQL-storage (MySQL) custom_table is added to the same MySQL host as Drupal, either as a table in the Drupal system DB or as a table in a ...
1
vote
1answer
542 views

How to properly compare values of two identical entities?

I have a custom entity that is not revisionable and I need to store any differences made by the user - and only differences, so if nothing has changed there should be no entry. I am doing this in ...
2
votes
2answers
7k views

Twig get value of field in entity reference

i have a content type "actuality" with a reference to an other content type "event". In "event" i have a "field_date" which i want to print into my "actuality" node. What is the best way to do that ? ...
1
vote
1answer
468 views

problems with entity translation insert hook

I'm using the entity_translation_insert() hook to set the value of a field when a node is translated. I can successfully edit the $entity from within the implementation, but how should I save the ...
2
votes
2answers
1k views

Set entity reference target_id in migration yml

I migrate Drupal 6 to Drupal 8. In Drupal 8 I have content type that has field with type Entity reference that reference specific taxonomy dictionary. I can't find out how to set Entity reference ...
1
vote
2answers
794 views

Set a boolean (single on/off checkbox) value while creating a node

I am creating a node (in Drupal 8) with the following code. use \Drupal\node\Entity\Node; $node = Node::create([ 'type' => 'calendar_data', 'title' => 'testing finaly ...
1
vote
1answer
450 views

Get field from another content type in Views

I have two content types, 'user' content type where I have some info about user and then 'post' content type. Now I have a view that gets all 'posts' and shows them correctly but I would need to get ...
7
votes
2answers
399 views

Safe and elegant way to access nested entities via fields

I've seen a variety of approaches to access entity values in the theming layer. The code below is just a simple example using magic methods. It assumes all values are set - if any part of that returns ...
1
vote
1answer
457 views

Product images with thumbnails and preview

I would like to have image gallery with thumbnails and preview above for every product in my Drupal 7 site. What I need to achieve is for example here: http://cz.tp-link.com/products/details/?...
0
votes
2answers
769 views

How can I pass variables from views template to node template?

I have a view of contents of a content type. This content type has fields which references entities of another content type (and that in turn references another set of entities of yet another content ...
0
votes
1answer
490 views

Custom content type which is a check list

I am trying to build a new project in which i as admin can easily add or edit a checklist which is used for tracking a days job which i want any registered user to fill out . This is possible either ...
2
votes
1answer
462 views

Arrange formatted fields in Views row using a template

I want to render the rows of my “Recent content” Views page using a template in order to subdivide the rows into multiple divs, freely move around the rendered fields within these divs, and apply ...
0
votes
1answer
528 views

View modes are stuck on default view

I had my site for quite some time and just started to use the display suite view modes feature for changing the displays per node. I made new view modes and tried to change them for my nodes, but it ...
0
votes
1answer
453 views

Save selected values from a checkbox into a field

I've the next form. $query = "SELECT name, tid FROM taxonomy_term_data WHERE vid=2 AND language = '$language_url';"; $result = db_query($query); foreach ($result as $row2) { $options2[$...
1
vote
1answer
613 views

How to make a reference to an entity using the uuid of the entity?

Is there any way to make a reference to an entity (using refereces, entity reference or relation) using the uuid of the entity? I'm using features and uuid_features to export the content but ...
2
votes
1answer
2k views

Retrieve taxonomy terms with EntityFieldQuery for a given parent term

I am retrieving a tid of a taxonomy term by using EntityFieldQuery. However, I need to cross-link the taxonomy_term_hierarchy table to list those terms which have a particular parent, but I am not ...
0
votes
1answer
584 views

How to create a parent content type which consists of other child content types?

I want to create custom content type (parent) which consists of other custom content types (children). Is this feasible in Drupal 8? Or I should do it programmatically? Example: I want to have custom ...
1
vote
1answer
557 views

RouteNotFoundException when trying to delete a custom entity

I am building a custom component in Drupal 8 that has an entity with child entities i.e., TeamEntity has one or more MeetEntity objects. When I navigate to the "Delete" link for a given MeetEntity, I ...
3
votes
2answers
506 views

Strip HTML tags from Field Collections in Services Views

I'm trying to strip the HTML tags from a JSON response I generated using Services Views, but I'm not having any luck so far. I have a content type with a Field Collections field in it that is ...
0
votes
1answer
455 views

Show node body fields for entity reference checkboxes widget?

I need to show the body field of the nodes next to their checkboxes in an entity reference field widget (default is just their node titles). Is there a way to do that without writing a new widget?
0
votes
1answer
451 views

How to make relationships between users

I have the quiz module installed on my website. I have setup two user roles on my site, Student and Parents. I want to make a view that shows the results of a parents children. Now I have made two ...
1
vote
1answer
522 views

How to set body field display programmatically on node type install?

When hook_installing a new custom node type filled with custom fields I call field_create_instance($instance) where I also set the custom fields' display like so: 'display' => array( 'default' =&...
4
votes
1answer
76 views

Benefit of config entities over regular config entries?

In Drupal 8 it is possible to store configuration in "config entities". However, the same can also be achieved with non-entity config entries. E.g. one example for a config entity schema, from core....
3
votes
2answers
3k views

How do I implement the equivalent of hook_url_inbound_alter()?

I'm working on a module which will resolve URLs to entities by altering inbound URLs so that if they contain an entity ID with following pattern "-{entity_id}" user will be redirected to correct URL. ...
0
votes
1answer
84 views

Is there a way to render a node with view mode via token?

Is there a way to render a node with view mode via token? Like: [node:5:teaser]
0
votes
1answer
21 views

How to get taxonomy term values?

In my user entity, I have a term reference. In that vocabulary, I have a regular field. How can I fetch that field's value? I tried the below in devel/php to no avail. $user = Drupal\user\Entity\...
0
votes
2answers
582 views

Entity Reference multi value fields, filter on parent

I have two content types: Family and Members. Family content type has an entity reference field of type Member and can have unlimited values(multiple values). My question is: How to create a view that ...
1
vote
1answer
507 views

It's a way to select by default N/A checkbox

I want that if a fields is not mandatory the N/A options on select box is ticked by default. I have tried to tick default value N/A on the field but after the setting disappear. I use Drupal 7.15. ...
2
votes
1answer
524 views

'Views Field' issue in NO RESULTS BEHAVIOR - Hide if empty not working

'Hide if empty' configuration of views is not working properly as a result all the empty fields are showing. Is there any work around to force fully hide empty fields in the views result (Page/block) ...
14
votes
4answers
7k views

How to list all available entity types?

How to list all available entity types in Drupal using drush? Related: How to get list of all node types?
8
votes
3answers
4k views

Changing a node's content type

In Drupal 7, I can easily switch a node's content type by using Node convert. Node Convert, however, has not been ported to Drupal 8, nor does there appear to be much enthusiasm for the port. If I ...
2
votes
1answer
525 views

autofill from taxonomy term fields

I'm trying to connect a field of a taxonomy term to a field in a content type, something like this: Auto-Fill from on content type to another I tried this on a node and it's working, but now I have ...
1
vote
2answers
492 views

Show initially 4 fields for Text field with unlimited value

I am building a website using Drupal 7. In my website there is a form for user to add some content. In the form there is a field of type "Text Field" (core). The "Number of values" for this text ...
1
vote
2answers
470 views

create a custom field schema

When I create a new field programmatically, drupal create a default schema for my being added and for each new field added is create a new database schema. I noticed that the columns always have the ...
0
votes
0answers
9 views

Missing is empty operator on custom entity views integration

I have a custom entity called measurement. There is a baseFieldDefinition field called completed. When I am creating a view for this custom entity, I want to add a filter to the view so that only ...
0
votes
0answers
27 views

Entity print module. How to create TOC?

I'm using entity print module and wkhtmltopdf library. Even though I've checked the create table of contents on the configuration, I don't know how to do that. I've created h1, h2 and h3 but the TOC ...
0
votes
1answer
338 views

EntityDrupalWrapper->value() causes infinite recursion on user login?

I have a few instances on my site where I perform actions on User Login. I create an EntityMetadataWrapper like so: global $user; $uw = entity_metadata_wrapper('user', $user); And then I go to ...
0
votes
1answer
30 views

Content entity doesn't load on edit

I have a custom entity, BaseEstablishment which is an abstract base class, implemented by Practice. abstract class BaseEstablishment extends ContentEntityBase implements EntityOwnerInterface { // ...
0
votes
1answer
17 views

Why is data-quickedit-entity being printed in plain text when I'm signed in?

I have a template for theming paragraph sections that, for some reason, prints out data-quickedit-entity-id="paragraph/2" in plaintext above any of my paragraphs that contain images. {% set bgcolor = ...
0
votes
2answers
38 views

How do I get a plaintext list of tags from a multi value entity reference field?

I have a module that's making custom RSS feeds for me. In a content type, I have my tags stored in "field_tags" entity reference field. My goal is to get the names of all the tags, and ultimately ...
0
votes
1answer
476 views

Drupal 7 Webform Components Related To Individual Nodes

I am attempting to create a decision making "questionnaire" in Drupal 7. I am currently using the Webform module to create the questionnaire. The questionnaire (webform) will create a list of related ...
0
votes
0answers
14 views

Setting default value to custom fields in menu items

I created a custom boolean field in my menu item using this hook_entity_base_field_info function Mymodule_entity_base_field_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) { if ($...