Questions about the entity API, the API that allows to create entities in Drupal 7 and forward.

learn more… | top users | synonyms

0
votes
1answer
15 views

Change custom entity fields

I'm facing very strange problem with changing my custom entity's fields. I've a custom entity with id, type, .. , premium, premium_expires_at, .. fields. It was working without any problems with its ...
0
votes
1answer
12 views

Why does entity_metadata_wrapper does not preserve node's custom URL while updating other fields?

I am programmatically loading a node of custom content type (i.e. staff) using entity_metadata_wrapper and add a reference to a collection of other nodes and then save the node. The custom nodes ...
0
votes
1answer
18 views

How can I retrieve the profile2 fields selected in a custom modeule?

I am totally new to entities in Drupal. I have used the Profile2 module to add a few profile types. This is displayed in the add/user screen as Customer. After adding the profile type I manage the ...
1
vote
1answer
37 views

Performance: Efficient use of EntityFieldQuery (with node_load OR node_load_multiple) to update thousands of nodes with/without conditions

I have script that queries a system called Symplectic for publications of over 30 users (each authored over 300 publications). Most of the publications are authored jointly by more than one user. I ...
1
vote
1answer
30 views

Get a configuration option from node type structure

I'm working on a module and was wondering how to get a node type setting (that was set when creating the node type at: admin/structure/types/manage/YOUR-TYPE) inside a node creating/editing page. I ...
0
votes
1answer
10 views

Does performing $entity->save() on field collection programmatically clears the page cache of it's node host?

I am using $entity->save() on a custom hook_cron that runs every minute. Does anyone knows if by doing $entity->save() , Drupal will clear the page cache of the nodes/views/panels housing it?
2
votes
1answer
79 views

entitymetadawrapper with field collection multi value

How can I save multiple values in a multi-value field collection using EntityMetadataWrapper ? Here's some of my code $field_collection = entity_create('field_collection_item', array('field_name' ...
0
votes
1answer
44 views

update shipping profile on user update

I use drupal commerce, I want if user info update if there is exist shipping profile update it else create new. function mymodule_user_update(&$edit, $account, $category){ ...
1
vote
0answers
18 views

Injecting field data in a custom entity

I have created a custom fieldable entity. Now I want to inject the field data into the entity and render the complete entity with the fields. The following code is working for text fields and ...
0
votes
1answer
20 views

Stop rendering custom entity label in view mode

I have declared a custom entity with a schema with a few fields on which is all working as I expect. I want to remove the label when rendering the entity so have tried the following. Added some ...
0
votes
0answers
19 views

How to implement a disaggregated data property

When users on my site register, they must enter some address information after which an external API call is made. The response contains an array of additional, useful location information. Some of ...
1
vote
1answer
21 views

Get a list of revision IDs for any given entity?

What's the most uniform method for getting a list of revision IDs for any given entity, programmatically?
0
votes
0answers
31 views

How to declare a field in a custom entity as a geofield for leaflet views integration

I am trying to use leaflet with a custom entity that has geocodes in them. Below is the custom entity called Places. function places_schema() { $schema = array(); $schema['Places'] = array( ...
0
votes
0answers
53 views

Make Entity API aware of new custom field

I am using a module that creates a field type "ean_hotel_hotelid". I am using Search API and need to index this field, but it is not available to be indexed. Search API will index all fields and ...
0
votes
1answer
26 views

Is it wrong to programatically create an entity without its required fields?

This is a general question, but based on a specific situation. In Commerce the standard way of customising a product AFAIK is to use Commerce Customizable Products. It allows you to create different ...
0
votes
1answer
19 views

Fatal error: Class 'RulesI18nStringController' not found in entity.i18n.inc on line 31

My client drupal site stopped working suddenly and gave me this error Fatal error: Class 'RulesI18nStringController' not found in entity.i18n.inc on line 31 i checked the rules module and entity ...
1
vote
1answer
33 views

Remote Entity Create with Node Reference

I am writing an Android app which is creating Drupal nodes remotely. I am creating these nodes via a straight php form. But now I need to create Nodes which are node_references of the main node. ...
1
vote
0answers
51 views

How to use user_load() for user on $_GET[] request in Drupal way?

I'm trying to get UID of users on $_GET[] request, following is my module code: my_module.module function hover_card_init() { $module_path = drupal_get_path('module', 'hover_card'); ...
0
votes
0answers
20 views

Is it possible to insert value in field using rules?

How can I insert data in database using rules, I created entity type job and added some fields. I want to insert values inside those field when the flag button is clicked. I tried "set a data value" ...
0
votes
1answer
39 views

Example Hook form validate, get all node information after save news field

In a custom module, I do some operations on several content node (add field_collections and save) After that, I need to get all field_collections of my content nodes. But when I get, I have the old ...
2
votes
2answers
129 views

How to pass an extra argument to an entity form?

Suppose, I've two entities: entityA entityB A user creates an entityA and has the option of creating multiple types of entityB referenced from a single entityA. For example, a parent-child ...
0
votes
1answer
34 views

Making entities under another entitytype

Suppose, I've created -name -machine_name an entity_type myentity with its schema as: -name -machine_name Next, I want to create another entity subentity that will be grouped under myentity. ...
0
votes
1answer
28 views

create chains of views joins so one view can 'see' across more than one join

Assuming the individual joins work can we join multiple times across columns like this?... (BTW I've checked this first query and it does indeed work correctly) SELECT * FROM a LEFT JOIN b ON a.a_id ...
0
votes
0answers
56 views

create entity with entity_metadata_wrapper and set Date value

I want to create a node entity. This node contain a date field. So, how can I set the date value ? (using entity_metadata_wrapper) After several google search and code try, I don't find the ...
1
vote
1answer
28 views

Programmatically created field doesn't appear in Views fields

Here is my little module that adds "markup" field to commerce_product table, but I can't select and display it in Views: function comm_markup_schema_alter(&$schema) { ...
0
votes
1answer
22 views

an entity_metadata_wrapper for a form_content in form alter hook?

There a few days ago, someone in this website advised me to use the function entity_metadata_wrapper. Thanks that, I can get and set fields of entity without use heavy code. Now, I would like find ...
1
vote
1answer
68 views

Passing object in routing.yml

I have an entity and when I try to pass the whole entity object, only the name is passed through the routing. Here is the relevant code in routing.yml: mymodule.myentity_info: path: ...
0
votes
2answers
24 views

Feeds : creating a node dependencies at importation

The Excel file I'm trying to import is comprised of two part, the first three columns describe a node that might or might not exist currently, and the three last columns are my entity informations. To ...
1
vote
1answer
27 views

Access denied while deleting an entity

This is my Config entity: * @ConfigEntityType( * id = "myentity", * label = @Translation("My Entity"), * controllers = { * "storage" = "Drupal\Core\Config\Entity\ConfigEntityStorage", ...
0
votes
1answer
26 views

EntityListBuilder only shows the last Entity that was added

I've build up an Entity for my module. The problem is that the EntityListBuilder doesn't show all the entities that I've added. Only the last entity that I added shows up. Here is the drupal sandbox ...
0
votes
1answer
67 views

Building EntityForm in Drupal 8

I'm continuously getting the error: Drupal\Core\Config\Schema\SchemaIncompleteException: Incomplete or missing schema for mymodule.myentity.myentityname in ...
0
votes
1answer
54 views

Creating multiple views from Entityform Submissions

I would like to create multiple views containing filtered/ordered results from submissions made into forms created using EntityForm. In the documentation and in question on DA(The Entityform module ...
0
votes
1answer
43 views

Double click quickly on the entity save form two entity get created [duplicate]

I am using Entity Construction Kit 7.x-2.0-rc2. I have created one entity type with some manage field as title,message. if i double click quickly on creating entity then it will save entity form two ...
0
votes
0answers
107 views

How to attach a taxonomy term reference field to a custom drupal entity

I am creating a fieldable custom entity in a module, and need to attach three taxonomy term reference fields to the entity. My entity is declared in my module's .module file as follows: function ...
0
votes
0answers
13 views

update record entity api [duplicate]

Im using entity api. How to update record in entity api i have: class ExampleTaskController extends EntityAPIController { public function create(array $values = array()) { global $user; ...
0
votes
0answers
10 views

Update fieldcollection on node save/update

I have a rather complex setup here. A node contains some fieldcollections as well as some custom form elements. On save, the values from the custom form elements, should end up in the ...
0
votes
1answer
26 views

How can I use View modes for entity without bundles?

I have an entity that has no bundles(ie. it has itself as a - 1 - bundle) and I need to be able to use View modes for it. My understnading is that the Field UI needs the 'bundle of' entity to exist ...
1
vote
1answer
53 views

How to display an entity property 'type' with form api 'type' for display in a form and then setting with the submitted value?

Is there is process/ function that maps data types that you can use in entities (specifically custom entities using the Entity API) to form #type options? This is to dynamically add a field to a form ...
0
votes
0answers
24 views

How come entity API's entity_load does not check for access

I'm using the Entity API with my custom entity: function mymodule_entity_info() { return array( 'myentity' => array( 'label' => t('Entity'), 'controller class' => ...
0
votes
1answer
50 views

Administrative form to create new entities of a custom entity type

I have created a custom entity type NOTE: it is based on an existing database structure and so ECK is not (according to Programming Drupal 7 Entities p. 84) able to deal with exposing an "existing ...
0
votes
1answer
42 views

How to import entities into Drupal 7?

When using nodes, I use the rather good Feeds Import module and all is well with the world. I now need to use an entity as don't need URLS, comments etc so have created one called 'Cars' and have ...
0
votes
1answer
25 views

set referenced entity programmatically

I have a view that displays a content type "offers" for a specific "task" (content type), the "task" content type has an entity reference field that reference an "offer". The view shows the title of ...
0
votes
0answers
59 views

Drupal commerce re-indexing causes exception

I'm trying to re-index all my products on my drupal commerce website and when I do so I get the following error message: An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information ...
1
vote
0answers
33 views

How do I add custom validation constraints to Entity fields? [duplicate]

I'm trying to add validation (i.e. constraints) to a field added to a specific (node) entity. As per documentation here https://drupal.org/node/2015613 i'm trying to change the Field Definition to ...
0
votes
2answers
49 views

Add values to an existing custom entity bundle

I've created a custom entity with bundle and added 3 fields to the bundle(namely recipient, sender, flag). How can I add values to it programmatically. Any help would be appreciated. Thanks
0
votes
0answers
29 views

The save() function permanently alters content when used with hook_preprocess_html. Is there a way to do the same thing for a single view instance?

I was planning to use an entity wrapper to conditionally fill in a (potentially) empty field. The use case is the following: Some users want to manually fill in the field with machine name ...
1
vote
0answers
17 views

How to use a field as an entity's property

My module provides its own entity. I need my entity to have a link field with multiple values. The module link is suitable for this. At install hook, I create a field and a field instance of link ...
0
votes
1answer
32 views

Which is the best way to create an entity? [closed]

I would like to use entity concept in my next project.So , is it good to use Entity Construction kit for creating entities ? How about Model Entities ? Which is better ?
2
votes
2answers
73 views

How to check if entity's property has a value

How can I check if entity's property has a value? I don't think this is the "drupal way" to check it like this $page_optimization->title->value() !== '' Is there any method, something like ...
2
votes
2answers
43 views

How can I entity edit path?

I made a module, and defined my custom entity there. I set admin ui interface 'admin ui' => array( 'path' => 'admin/structure/optimizations', ), Then is some code, I have my entity object. ...