"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
0answers
17 views

Can the BaseFieldOverride class be used to implement hook_entity_bundle_info()?

I need to implement hook_entity_bundle_info(), and I noticed that the documentation includes a link to Finalize API for creating, overriding, and altering code-defined bundle fields. In short, that ...
-1
votes
0answers
11 views

Entity Registration data [on hold]

Total newb here. Where is the Entity Registration signup data stored? How do I see it, delete it? For that matter, how do I view Views? Thanks for any help! Richard
0
votes
1answer
15 views

Getting the actual on/off value from a radio button instead of 1/0

I'm trying to store some data from an EntityForm to a txt-file. This can be easily done with an entity wrapper, but when I get the value of the radiobutton (boolean) they selected I always get 1 ...
0
votes
1answer
25 views

Entity 'changed' column doesn't change upon save

I have a custom entity called "release". Release has "state" and "building percentage" fields, which values may change during the release process. In both "setState" and "setPercentage" entity ...
-1
votes
0answers
17 views

Loading difference between referenced and referencing entitis [on hold]

I am wondering is there a difference how fast the entitis get loaded or founded? Logical I think referencing entitis must be slower because drupal has to check all entitis but am I right with this?
0
votes
2answers
26 views

Adding constraints to a content type

I would like to create validation for a several fields on a content type to check if they each have unique values from each other. The part I'm struggling with is how to add the constraint for just my ...
1
vote
2answers
30 views

Overriding fields from one content type which inherit from another content type

Imagine we have 50 different professions in the same domain (medicine for example). As you know, in a region, we can have 5 doctors who have the same addresses, and in another region we can have 15 ...
0
votes
2answers
19 views

Create content after editing other content-type

I have a certain content-type B with an entity reference to items of content-type A. I'm trying to programmatically create a content-type B node when a bool field in content-type A is set to true, ...
1
vote
1answer
26 views

Force Rebuild of Custom Entity's Task Menu

My module has a custom entity along with custom menu tasks. I would like the tasks shown for a specific entity to be dependent on its properties. Once the properties change I would like the task menu ...
0
votes
1answer
28 views

what is #target_type in EntityAutocomplete?

what is #target_type in EntityAutocomplete? in EntityAutocomplete it said: #target_type: The ID of the target entity type. how can i see the list of the ID? and can I extend the ID on my own? ...
1
vote
2answers
58 views

How to add “Content type B” from within “Content type A” and then display both together

I have the following scenario: Content type A Content type B Content type A is added by the admin role. Content type B is added by the students role. Once Content type A is created, then on ...
0
votes
0answers
21 views

How to make entity revisions remember the old bundle, if it is changed?

There are some tools in Drupal that allow you to change the bundle of an entity (e.g. the node type): The Node Convert module The migrate module, if you update an entity and change the bundle. Any ...
1
vote
1answer
29 views

How to update a biblio field with Entity Metadata Wrapper

I was able to update a field using Entity Metadata Wrapper (EMW). Here is how I could accomplish this. $node_wrapper = entity_metadata_wrapper('node', $nid); $node_wrapper->field_custom_field='new ...
0
votes
1answer
18 views

How to add a view mode caching dependency in my custom block?

I have a block which renders fields of a node. The output of each field is controlled in the view mode settings of the node entity. Now, how can I add caching which is depended on the view mode ...
1
vote
3answers
34 views

How can I programmatically render a node's field respecting the view mode settings?

I want to render a node's field inside a block. It works like this: <?php if ($node) { if (isset($node->field_body_secondary) && $field = $node->field_body_secondary->value) { ...
2
votes
1answer
38 views

How to change the value of entity reference’s field by using the Rule module?

I have two content types: Inventory Sales In Sales content type I referenced “Inventory Content type” through entity reference module. In Inventory content type, I had a field: “stock_available” ...
0
votes
0answers
27 views

Why would Field::preSave not be called?

<?php /** * @file * Contains \Drupal\custom_widget\Plugin\Field\FieldType\TaxonomyPriorityField */ namespace Drupal\custom_widget\Plugin\Field\FieldType; use Drupal\Core\Field\FieldItemBase; ...
0
votes
0answers
25 views

How can I have an account before registration?

I want to make site on Drupal 8 about some events. For every past event I shall have some information, including people, who was leading that event. But they shuld be able to register on that site, ...
0
votes
1answer
69 views

Use a custom field with a custom entity

How can I use a custom field with a custom entity? Based on Drupal examples, how I can use field_example_rgb (from field_example) in my own custom content entity with bundles? I will add this field ...
0
votes
1answer
21 views

How to remove custom module provided entity instances by the time the module being uninstalled?

I have the following use case: I have a custom module, which defines a custom entity type. The custom entity type has some content in the database. Module needs to be uninstalled now, but it can't,...
-1
votes
0answers
11 views

How to print or debug a EntityFieldQuery [duplicate]

I want to print the sql statement of entityfieldquery. How to achieve this?
3
votes
1answer
41 views

How do I render an entity view mode like 'teaser' in a twig template?

I have an entity reference field in one content referencing an other content. What I'm trying to achieve is to display that reference in a teaser format programmatically. I was hoping that I could ...
0
votes
0answers
16 views

How to add new item to node field programmatically [duplicate]

How to add new item to exists node field, my field machine name is "field_description", it's unlimited multi values long text field. according to my experiences with entity wrapper in Drupal 7 I ...
0
votes
1answer
32 views

How to get an array of referenced entity ids from an entity reference field

I have a entity_reference field with BaseFieldDefinition::CARDINALITY_UNLIMITED cardinality. I want a list of referenced entity ids. I know that I can get all the referenced entities by calling $x->...
1
vote
1answer
140 views

How to return node object on programatically node creation

I can create node programmatically with following snippet use \Drupal\node\Entity\Node; // Create node object with attached file. $node = Node::create([ 'type' => 'article', 'title' ...
1
vote
1answer
21 views

how to make a custom entity multilingual

I made a custom entity (ty drupal console). but i would also like to make this entity translatable. I enabled all 4 multilingual core modules but i don't see the "translate" tab in my entity nor can i ...
0
votes
1answer
22 views

How to change a file field value with entity_metadata_wrapper

I need to remove a file field value, and instead, assign a new value to it. The file field contains video and the new video is in the videos directory. This is my code to delete a file field value (...
3
votes
1answer
21 views

How to make 2 Rules work that use the very same Rules Event?

On a D7 site I have two rules (using the Rules module) reacting on the same event which is 'After saving a new entityform submission'. When the actual event occurs only 1 gets fired, even though I've ...
0
votes
0answers
24 views

Alter form for a translated file field

We are building up a Drupal 7 multilanguage website, using a mixed approach Content and Entity translation. Nodes are content-translated, nodes images are almost shared among languages. We use File ...
0
votes
0answers
19 views

implement filed collection with content entity

My scenario, I have a requested_course content type, it has title/image/description fields, visitors of website can upvote to requested course ,when each user upvote on each course, we get some ...
1
vote
1answer
16 views

Entity reference field in REST

I'm trying to create content with REST, everything worked correctly until we need to an entity Reference field,I add it to my content type and in want to pass entity referenced nid to it with Part ...
1
vote
1answer
21 views

How to get the entity that field belongs to in the case of an entity reference field

Here is my use case: I have created a media bundle (FILM IMG) to store a media entity (image) field. I can manage it at admin/structure/media/manage/film_img/fields In a content type named "FILM" , ...
1
vote
1answer
48 views

Catch the English name of a translated taxonomy term (token)

I'm building up a multilingual website (Drupal 7) with Locale and Content translation modules enabled for nodes. The node category is managed thru a content_area field (taxonomy term thru Entity ...
0
votes
1answer
54 views

Add text field to poll entity

I have installed the Poll module in Drupal 8. I need to add a field to it, such as a text area for the poll description. How can I add a field to a content entity like Poll, which is not a content ...
0
votes
0answers
17 views

changeable form according to the Selected options

I have a little problem: I have a content type called "PRODUCT" Administrator add an infinite numbers of "PRODUCT" and each "PRODUCT" had a name and a description and a form (like the webform) the ...
0
votes
0answers
10 views

How can I view and manage individual commerce product revisions?

It is possible to view a list of revisions for a given commerce product on admin/commerce/products/%/revisions. Turns out this is really a views page, defined in commerce_product_ui.views_default.inc. ...
0
votes
1answer
13 views

entity_form removes uid

So i have defined a block case 'foo_post': global $user; $values = array( 'type' => 'foo', 'uid' => $user->uid, 'status' => 1, 'comment' => 0, ...
1
vote
1answer
20 views

Drupal 8: How can i get the node id the comment is attached to in hook_comment_insert?

How can i get the node id the comment is attached to in hook_comment_insert? I tried the following code. function mymodule_comment_insert(Drupal\Core\Entity\EntityInterface $entity) { if ($entity-&...
0
votes
1answer
26 views

Config Entity list_builder controller path throws Route Does Not Exist error

I have created a custom config entity, which declares a list_builder controller to return a list of the created entities. Before creating a config entity, it renders as expected. Once I create a ...
1
vote
1answer
32 views

Why user's rights has that impact on my Views pages?

I have two custom entities (Adhérents and Personnes) linked to each other and to User. One 'Adhérent' is mainly a "family" and has these fields: label, adresse (postal address), Téléphone (landline ...
0
votes
1answer
21 views

Getting the name of a tag

I've noticed that in using the default Drupal 8 API to get a feed of articles (using the REST View) the Tags field is returned as the following: "field_tags" : [{ "target_id" : "1", "...
0
votes
1answer
10 views

How to change the view for a “Views: Filter by an entity reference view”-mode entity reference field on the node/add or edit form?

I have 2 content types: registration (R) and class (C). R has an entity reference field which is referencing to C using the "Views: Filter by an entity reference view" mode. The entity reference field ...
0
votes
1answer
21 views

How set a time type field programmatically?

I create a custom content entity type. I want one field for the event time. Since there is no time field, but a dataTime_type, i create a plugin for a custom field : FieldType : TimeItem.php /*...
1
vote
1answer
20 views

Find an entity that most recently referenced a particular entity

Scenario A content type - Wardrobe references another content type Product via Entity Reference field - field_product. Problem Statement I need to find the Wardrobe content which most recently ...
1
vote
0answers
27 views

Import Entities

I'm looking for method of importing an Entity Configuration. I'm using ECK to build my Entity Types and Bundles. But I have a project where I need to create an entity with a rather large number of ...
2
votes
1answer
33 views

How to make a multi field reference multiple content types?

I'm trying to implement a Project Member relationship but I don't know how to do that. I have as a content types: Project, Member and Position as the attached UML diagram shows. My doubts are about ...
0
votes
0answers
16 views

How do I rewrite results distinctly in a field set to show all results in multiple field settings?

I am creating a view to list schools. And each school can have multiple teachers, which I want to display like this: Metropolis City High School - Clark Kent, Bruce Wayne Smallville Middle School ...
2
votes
2answers
36 views

How to reference existing Paragraph entity?

I'm trying to create an entity reference field for existing paragraph, but can't seem to figure it out. I've tried creating a normal entity reference field (content) but that only gives me the ...
0
votes
0answers
22 views

How do I get an entity reference parent using tokens?

Setup I have an entity reference chain that is kind of complicated. It's basically using Drupal to build a dynamic database with nodes being the tables and entity reference acting to store external ...
0
votes
1answer
26 views

Assigning entity (node) to group (og) programmatically

How to assign an entity to a group programmatically? I have referred to this question however it doesn't seems to work: $values = array( 'type' => 'my_type', 'uid' => $user->uid, ...