Questions tagged [entities]

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

0
votes
1answer
513 views

Why is hook_form_alter() not setting default values in _after_build function on /node/add/myct in D6?

I've got a validation form (id="mymodule-myct-verify-form") that retrieves data from temp_node to populate it's hidden fields. On submit, the form sends its data to /node/add/myct. (currently via $...
3
votes
1answer
952 views

Specify a node type (bundle) in entity reference field

I have a custom entity type which has an entity reference field. $fields['referenced_article'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Article')) ->setDescription(...
1
vote
2answers
507 views

Cloning entities

i have 3 different entities build with help of EntityApi module. They connected with each other with ID column in tables. Entity - "Purchase" Entity - "Catalog" has 'purchase_id' column in table ...
0
votes
0answers
7 views

Add a FULLTEXT index on specific column

I'm currently implementing a custom search engine in my custom module. In order to optimize my module, I would like to perform SQL queries by using the syntax MATCH....AGAINST in Entity queries. By ...
5
votes
2answers
6k views

Add content type field programmatically

My module provides a configuration form which allows to select a content type and on submit 2 new fields will be added to the selected content types. I want to add these fields to the content types ...
1
vote
1answer
464 views

trouble with a checkbox on the user registration pages

I created an extra checkbox field for the user registration form This is the field setting page. (Standaardwaarde means "Default value.") In the setting page, the field is unchecked, but it's ...
1
vote
1answer
423 views

How to detect if “Show end date” is checked?

Trying to find a way to get the value of the checkbox "Show end date" on a date field on drupal 7. Is it stored somewhere in the database? Can't find it. Its definitely not in the $node object. Any ...
1
vote
1answer
504 views

How to properly check in entity form validation if field is empty?

I have a content type "A" (Node entity type). In it's node form (new/edit) I need to check if some fields are empty or not (which are not required in general). My first intention was to use FormState "...
1
vote
1answer
433 views

How to use Views PHP get Taxonomy field value and field collection value?

Dear drupal expertise, I am currently using Views PHP module to use Field Global PHP to render view value, but I dont know how to read taxonomy field value and field collection value, did anyone ...
0
votes
0answers
31 views

Profile entity type missing form class

Getting following error, Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException: The "profile" entity type did not specify a "employee" form class. in Drupal\Core\Entity\...
1
vote
1answer
808 views

Programmatically create a paragraph entity reference field

I need to create a config page, that is able to add social media information ( name and icon ), the user must be able to add as many social medias as it wants. To do so, I'we created a paragraph with ...
0
votes
1answer
10 views

How to join the `field_data_field_*` tables with `node` table using SQL?

I apologize if I ask for something obvious, but I am asking because I could not find a simple answer anywhere. I know how to work with these tables in the PHP Drupal code, which built-in functions to ...
0
votes
1answer
20 views

Show Content Type Fields from a entity reference

I have a content type which i have linked to another content type. For e.g. Companies (Content Type) Employees (Content Type) When creating a new employee i have to say which company it works for so ...
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
515 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
12 views

After saving node type, entity_get_info('node') missing 'token type' property

After saving some node type on admin/structure/types/manage/node-type, node 'token type' is gone: $info = entity_get_info('node'); // isset($info['token type'])) == FALSE After I change common.inc ...
0
votes
0answers
6 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
476 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
44 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
538 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
467 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 ...
0
votes
1answer
52 views

Mismatched entity and/or field definitions - 8.7.1

I have updated the Drupal core from 8.6.4 to 8.7.1 using pantheon. Once I updated the core, Mismatched entity and/or field definitions errors are showing in status report. (Refer the screenshot) I ...
1
vote
2answers
777 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 ...
3
votes
2answers
375 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
455 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
743 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
461 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
523 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
610 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
578 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
548 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
502 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
0answers
17 views

how to update FieldStorageDefinition in a hook update?

This is a feeds module related issue. An entity update that started to cause errors on 8.7.x after the removal of automatic entity update. Originally an entity definition needed to be updated using ...
1
vote
1answer
521 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
2k 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
71 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
20 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\...