"Entities" is the term that in Drupal 7 is used for nodes, comments, taxonomy terms, and users. Third-party modules can then define new entity types.

learn more… | top users | synonyms (2)

1
vote
1answer
21 views

How make a virtual field for view?

i want a vitual field for print value of sum in another entity : My 2 custom entity content : commandes_entity commandesLignes_entity reference to commandes_entity In the commandes_entity ...
0
votes
1answer
40 views

How do I add the edit link of a content in a custom view mode?

I have a content type (Sample) which includes a field (A) whose widget type is View. I'm using the Entity Reference View Widget View module for this. The output of this field is having only the ...
1
vote
1answer
4 views

How can an entity reference field be displayed as a select list that shows the selected entity?

The Problem I have a couple of entity reference fields that references a hierarchy of nodes. For the sake of simplicity let's use just the top level example Video Game -> Video Game Release So when ...
0
votes
1answer
30 views

How to choose between classic SQL query and Drupal 8 technic?

I have a custom content entity (amap_distributions_inscriptions) linked to 2 entity_reference 'datedistributionid' (which is basically the date of distribution plus other fields) and 'amapienid' (...
2
votes
1answer
11 views

Access list of view modes available for nodes

In my code, I need to get a list of all the view modes defined for nodes. In Drupal 7, it was available via entity_get_info(). What is the equivalent method for producing a list of available view ...
0
votes
0answers
16 views

How to programmatically populate FileEntity

I have a file entity with some custom fields, for example a date field. How can I programmatically set the field values? If I, for example, set date-field value with a DrupalDateTime object, I get an ...
1
vote
1answer
32 views

How to save the definition of an entity?

I am trying to figure out if there is a difference between saving an instance of an entity and saving the definition of an entity. My use case is this: I wrote a small module that defines an entity, ...
1
vote
2answers
27 views

Creating a watchdog log when publishing status changes on my own ContentEntityBase

I have a hierarchy of Entities derived from ContentEntityBase. Now I want to create a log when the publishing status ( = status field) changes. What is the best method to override/implement for this ...
0
votes
0answers
3 views

Using Automatic Entity Label how to add number if title is already used (unique)

I have setup auto entity label with tokens. All works great. Lets say I have a title e.g. tokens [firstname] [lastname] Displayed as: Tom Cruise But if there are multiple identical titles named "Tom ...
0
votes
1answer
36 views

What might cause my “User error” in Watchdog?

I'm trying to figure out the reason behind this "User error" in watchdog User error: "0" is an invalid render array key in Drupal\Core\Render\Element::children() (line 102 of /core/lib/Drupal/Core/...
0
votes
1answer
15 views

In entity form need Birthday reminder [closed]

i created a entity form with Users data entry like name, address, birthday, pan no. and i want birthday reminder for next 7 days upcoming birthdays list same for upcoming month birthday list in views.
0
votes
0answers
24 views

Drupal 8: Add fields from another form to a existing form in a widget

I am trying to build a module that provides a widget. The widget is based on FileWidget and I would like to add some fields from another form to the existing FileWidget form. I would like to save the ...
0
votes
1answer
24 views

How to retrieve ConfigEntity instance from config factory?

I have defined a config entity in my module (schema and class that extends ConfigEntityBase) - MyConfigEntity. When I use config factory to get config, Drupal returns instance of Config or ...
0
votes
1answer
20 views

Sort entityQuery by date published

I'm attempting to perform a query to retrieve only the three most recent nodes of a certain content type. $query = \Drupal::entityQuery('node') ->condition('type', 'blog_post') ->sort('...
1
vote
1answer
18 views

Restrict node list in entity reference field based on node field

My "Article" nodes have a "domain" field that links to a taxonomy term. My "Article" nodes also have a repeatable "entity reference" field "more like this" that links to other "article" nodes. How ...
0
votes
2answers
30 views

Access field data from entity in block plugin

I'm attempting to render certain fields within a block plugin but I'm not sure where to start as far as accessing the fields so I can render them. I'm able to get the node ids after I perform the ...
0
votes
1answer
27 views

How Drupal handles nodes 404 requests?

I'm curious about how Drupal 8 handles nodes 404 requests. I think there might be a route of 404 and then an internal check - if node id doesn't exists, it simply calls 404 route path. If this ...
2
votes
1answer
40 views

How to check if entity id exists or valid?

I have created a content entity type. When I save form, I got id in routing url, like: entityform/1 entityform/2 But if I directly access some non-existing id like entityform/999, page dies. In ...
0
votes
0answers
14 views

How can I make an entity reference to a translatable vocabulary show autocomplete results in the appropriate language

If I have an entity reference field on a node that uses a entity reference list view to create its list. How can I make it search and display results from the language currently being edited. (...
1
vote
0answers
10 views

Entityreference field autocomplete - dynamic attribute

I have one entityreference autocomplete field A which use views to return listing. I also have another field B (terms - listing) and want when I changed B field (terms - listing) to pass this value ...
0
votes
1answer
29 views

use entityQuery within a Block plugin

I'm attempting to use queries within a block plugin to avoid using views for performance purposes. namespace Drupal\my_plugins\Plugin\Block; use Drupal\Core\Block\BlockBase; use Drupal\Core\Form\...
0
votes
3answers
34 views

How to get node url of selected language?

I have a node with an array of multiple languages. [19] => Drupal\node\Entity\Node Object ( [in_preview] => [values:protected] => Array ( ...
0
votes
1answer
32 views

How add publish config block to a custom entity content

i have a custom entity content : Product. I am looking for a way to give the posibility to change the url of the product like this block : Block on the right. It's a screen of article content. ...
0
votes
1answer
25 views

After any AJAX form event, all Entity Reference Fields are blank

After any AJAX event in the form (Upload image, add a new field collection row etc.) All Entity Reference fields go blank. I have multiple entity reference fields, all using a view to get list ...
1
vote
1answer
155 views

How to check if field exists in an entity?

In entity node, I want to check if 'abc' field exists or not. If exists, I will get its value by $value->get('abc'). But the content type where this field doesn't exists, gives error: The website ...
0
votes
0answers
17 views

Entity Admin UI as Node Tab Link

I have an entity "metric" that has specified the following admin ui config: 'uri callback' => 'metric_entity_uri', 'admin ui' => array( 'path' => 'node/%/config', '...
1
vote
1answer
38 views

How to create dependent fields in Entity:baseFieldDefinition?

I have created a select list of content types in baseFieldDefinition $fields['ctype'] = BaseFieldDefinition::create('list_string') ->setLabel(t('Content Type')) ->setDescription(t('...
0
votes
1answer
23 views

Call to undefined function entity_create()

i try to include a node creation form by a field attach form. So i try to load the entity of a custom content type created by the back-office with is called 'friterie'. But when i call the ...
1
vote
1answer
53 views

How can I get all related entities of a node programmatically?

I am writing some drush scripts and find myself needing to get related entities (nodes) of the current node. However I can only find info for constructing views that do this. Can anyone tell me is ...
1
vote
2answers
39 views

How to render entity referenced nodes field inside node.tpl.php?

I have 2 content types: book and author. This is the structure: I want to use (print) some fields of author content type inside the node-book-tpl.php. How can I do that? Is there a method to ...
0
votes
0answers
21 views

search node for taxonomy fields: performance considerations

On Drupal 8, I am using taxonomy membership in a breadcrumb builder: every node not explicitly on a menu will have to be checked for membership in a taxonomy. I haven't come up with a better way of ...
1
vote
0answers
36 views

how to output custom image field (uri) from a Group entity on page.tpl.php?

I have a custom image field associated with a "group" entity(Created by the Group Module) that is called field_header_image. Im looking to output the image uri as background style in the page.tpl.php ...
0
votes
1answer
12 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
2answers
52 views

Add new field to custom content entity type

I have created a custom content entity type called Course. When I installed my module, Drupal automatically created the table schema for my entity, so all the fields I defined in Course::...
0
votes
1answer
14 views

Why entity autoloading doesn't work?

I'm trying to set up entity autoloading using hook_menu like this: $menu['e-shop/produkt/detail/%commerce_datasheet'] = array( 'title' => t('Products'), 'page_callback' => '...
0
votes
0answers
17 views

Form render element entity_autocomplete [duplicate]

I have a configuration entity ($context) and my task is to create the entity reference (reference to $value_entity). I am using an entity_autocomplete form render element. But the page is not loaded ...
1
vote
0answers
6 views

How do I import editable copies of an existing “child-node” into a “parent-node”?

Here's what I need: I want to be able to import content of selected existing nodes (let's call them child-nodes) into a new node (let's call it parent-node), and I want to be able to edit the child-...
0
votes
2answers
34 views

How to add extra data to a programmatically created node

Using Drupal 8 i am importing data from an external source and creating the node programmatically from the controller: $node = Node::create(array( 'type' => 'article', 'title' => 'some ...
1
vote
1answer
24 views

How to override entity:link() function?

I have an entity with entitylisthandler. In entitylisthandler, i have a function to build row like: public function buildRow(EntityInterface $entity) { /* @var $entity \Drupal\mymodule\Entity\...
1
vote
1answer
19 views

How to create custom ECK entity class (per bundle) [closed]

With ECK I created Entity type Vehicle, and added 2 bundles, Car and Truck Goal is to have a class Car so I can use Car::create() and similar entity functions, and also implement my own functions. ...
0
votes
0answers
7 views

Fixing a custom Entity Content Type - Links are going to Page Not Found

I'm coming into an existing Drupal 7 project and the previous dev created a custom entity type called Role Types which just has 1 textfield in it. I don't know why he did this when he could have just ...
1
vote
1answer
26 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
0answers
23 views

Generate an ID, Serial or Auto Increment number for child entities of a parse XML

I am importing several xml files with feeds tamper. Each file depic a "Contact", and using Xpath parser I am able to get child entities from each file/contact like his/her addresses. Using ...
1
vote
0answers
14 views

Entity references reciprocity

I have two types of content. The content type No. 1 to create Professional Profiles and the content type no. 2 to create Departaments. I'm using Drupal 7.43 version. First step: I created some nodes ...
0
votes
1answer
27 views

Content enity type: edit form not working

I have created a content entity form. Below is the code attached: /** * Defines the mymodule entity. * * @ingroup mymodule * * @ContentEntityType( * id = "mymodule", * label = @Translation(...
0
votes
0answers
9 views

Using hook_theme() and entity_metadata_wrapper instead of a view template

I have some custom theme templates using hook_theme which take an array of entity_metadata_wrappers to render the objects. I want to be able to render a view in the same way, using my theme hook. At ...
0
votes
3answers
59 views

How to correctly access entity elements in a twig template

I have an array of entities that i would like to render in a list. $ids = \Drupal::entityQuery('chemical') ->condition('tid', $tid) ->execute(); $controller = \Drupal::entityManager()->...
0
votes
2answers
21 views

Creating entity in Rules causes PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry

My application based on CRM-Core. I am using several rules which launch on the event "After saving a new crm core contact" and each has a crm_core_activity entity created as the rule's action. Is it ...
0
votes
2answers
32 views

How to delete children when main entity is deleted?

I am looking for the best way to delete children of my main entity when i delete it. I have 2 entity type : commandes_entity commandes_ligne_entity ( entity reference to commandes_entity ) ...
1
vote
2answers
66 views

how to import from csv file to EntityForm

I have two drupal sites with exactly same entity forms, I would like to import entityform submissions from site A to entityform submissions site B. I had a look into feed modules which works very ...