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

learn more… | top users | synonyms

2
votes
2answers
80 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 ...
-1
votes
0answers
12 views

Hook _entity_presave never called [on hold]

I have a custom content who contains one multiple collection field. From a custom module, I get and set the multiple collection field of my custom content. In a another custom module, I want modify ...
0
votes
1answer
22 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. ...
-1
votes
0answers
17 views

Sorting an entity_metadata_wrapper with array_multisort [closed]

When I insert a new element in my custom entity_metadata_wrapper, I would like to apply a sort: My structure: entity ->fieldA (its a multiple field collection) ->field_date (its a date ...
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
19 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
22 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
0answers
40 views

How to Create a form for an additional Form for my Entity [on hold]

I think I might be missing something simple here but can’t seem to find the answer. I’ve created a custom module for my Entities. And have made a form for it using 'admin ui’ What I would like to ...
0
votes
1answer
16 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
59 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
18 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
18 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
24 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
55 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
27 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
37 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
38 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
41 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
19 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
41 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
26 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
23 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
44 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
35 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
16 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
31 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
59 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
28 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. ...
1
vote
1answer
53 views

Is it proper to perform a db_update on an entity table?

I have a custom entity. During a save operation, under certain circumstances, I need to change the value of a specific field (not field API) of some other entities (of the same type). If I perform a ...
1
vote
1answer
63 views

Custom Entity with a uid property [closed]

We seem to be experiencing a very unexpected problem. We have created a custom entity called feature and it has a uid property. The schema is as follows: $schema['feature'] = array( 'fields' => ...
0
votes
1answer
10 views

entity_export - where can it be used?

I want to make use of the entity_export function for data migration. I see on the doc page http://drupalcontrib.org/api/drupal/contributions!entity!entity.module/function/entity_export/7 that Note: ...
0
votes
2answers
50 views

Get the last revision id of any given entity?

Is there a single, unified method in Drupal 7 to get the last revision id for any given entity object? If so, what is that method?
0
votes
2answers
76 views

Difference between a bundle and a conten type

Can somebody explain to me the difference between a content type and a bundle? Is the latter just a bundle for the entity node?
0
votes
1answer
46 views

anonymous User broken

I just migrated the site from sqlite to Postgres, using the drush portabledb-import module I'm getting a error page only when no user is logged in to the site. I can get logged in using the ...
0
votes
0answers
29 views

How to extend entityreference field by another custom field?

I want to add another field, which needs to be accessible by views (for display and ordering), to the entityreference table field_data_field_FIELDNAME. Structure of that table is: entity_type ...
3
votes
2answers
109 views

Minimizing the time taken for entity_load while using for apachesolr indexing

I am working on a site with a specific node type that has close to 50 fields, most of which are taxonomy term references, a couple of node references and a few conventional text and integer values. ...
0
votes
1answer
30 views

Using tokens with entities?

I'd like to be able to use tokens with entities, similar to how they work for node right out of the box with core. However, for whatever reason, entity tokens are not available to me even though I ...
0
votes
1answer
39 views

Is there an hook to react to custom entity updates?

I need to react to updates of custom entities wich are using Entity API (Redhen organization in my case). I tried using hook_entity_update($entity, $type) but it does not seem to be fired when ...
0
votes
0answers
57 views

Entity API error “EntityMetadataWrapperException” when saving Article

So, I've been facing this issue since last week and I'm not sure what's causing it: EntityMetadataWrapperException: Unknown data property field_mailing_list. in ...
0
votes
2answers
471 views

EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. in EntityMetadataWrapper->set()

I am creating nodes programmatically. I Have written following code, $e = entity_create('node', array('type' => 'some_node')); // Specify the author. $e->uid = 1; // Create a Entity Wrapper of ...
1
vote
2answers
81 views

load commerce coupon

I want to load coupons that have commerce_discount_reference=4. I find that can load them by commerce_coupon_load_multiple but I dont know how I add condition commerce_discout_reference=4. maybe ...
2
votes
0answers
25 views

How can I show all translations of a field in a node

I am working on a relatively simple multilingual site. I only need to translate the title of each node, so I thought a lightweight approach through entity translation and the title modules would be ...
2
votes
2answers
395 views

Programmatically create a node with alias and menu item using Entity API

I've seen the excellent documentation on Drupal.org about how to create a node in code, but that documentation doesn't address how to create the node's alias. I've seen code snippets that use ...
1
vote
0answers
49 views

Dates display incorrectly on node display after programmatic creation

Problem I have a form where users can create a node by filling in a number of fields. It creates a node using the Entity Metadata Wrapper as shown here. I have two date fields on this form, however ...
1
vote
2answers
105 views

How to redirect views of entity types (bean) for user roles?

RabbitHole does not provide this functionality for bean blocks and Entity Bundle Redirect does not seem to work. There is a user role which may edit bean blocks but I want to prevent them from viewing ...