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

learn more… | top users | synonyms

0
votes
0answers
27 views

How to clone a entity with its attached fields?

I am trying to create a entity with few bundles. I have used EntityDefaultUIController as admin UI callback. This provides me with few default functions such as clone, import and export. The problem ...
0
votes
0answers
24 views

Can't add content?

I have a content type called Video with a node title and a video field where i put the url of the youtube video i want ( Video Embed Field module ) . Everything goes fine until i installed some ...
3
votes
1answer
31 views

Session breaks Entity API

Whenever I try to use $_SESSION or variable_set it breaks the Entity API. It says "Fatal error: Call to undefined function entity_get_info() in ...
1
vote
1answer
25 views

How to change content type field values with the entity system — getting a “doesn't support writing” error

I've got a D7 content type with a few fields; nothing particularly special. I want to be able to programattically change the values of those fields from time to time, and so wrote a function like so: ...
3
votes
1answer
68 views

How to set value of file field with entity_metadata_wrapper

How do you set the value of a file field when using the entity_metadata_wrapper? I've tried doing this in code: $file = new stdClass(); $file->uid = 1; $file->uri = $file_path; ...
0
votes
0answers
31 views

Attach Entity “comment” to Entity “file”

Files (images) are uploaded within a content type with plup and plupload. These images are then displayed through a view. I would like to have a "commenting" functionality for each uploaded image. I ...
5
votes
1answer
60 views

How do you clear a field value with entity_metadata_wrapper()?

Suppose I have an entity with a field field_foo on it and I want to clear that field's value. What should I pass to $wrapper->set()? I have tried NULL and array() and both produce an error ...
3
votes
4answers
93 views

How can I get bundle of an entity from type and id?

I need to identify bundle of an entity from its type and id. For example, if the type is 'node' and id is 7, I may get 'page' as bundle. Thanks
0
votes
1answer
37 views

creating a custom entity which stores multiple bundles as per user input?

I want to create an custom entity(Lets say payroll entity) which has the following fields 1. Basic salary 2. Earnings 3. Deductions It is possible by Entities But now I would like to add some new ...
7
votes
1answer
199 views

Is EntityFieldQuery really this inefficient?

I am an admitted newbie to the Entity API, but am trying to cure that. I'm working on a site that uses a number of content types with various fields attached to them; nothing fancy. So, when I want ...
1
vote
1answer
25 views

how to check non existent field added later using entityfieldquery? [duplicate]

I added a required field in a Job type node later. So existing nodes don't have that particular field value. I want to include all such field values. But how can I do it? Here is query sample: ...
3
votes
1answer
60 views

how to define entity preprocess function

My custom module defines a custom entity, which extends the EntityAPIController class. I managed to make it basically working, i.e. displaying fields etc via my custom tpl.php file. But I would like ...
1
vote
1answer
33 views

Using Entity API, if given an entity in a function scope, how do you get the entity type?

This is very similar to this question: How do I get entity_type and entity_id from any entity page? But I don't know what that asker means by "Entity Page," and in my case, using debug_backtrace ...
3
votes
1answer
79 views

Should I create fielded content types (with 1000+ tables) OR create custom entities with properties instead of fields (way less tables)?

I have a case where I have a lot of entities that can be stored with Drupal as node (content types) and fields. I had to end up creating 105 content types, 20 taxonomies and in-numerous fields. And ...
0
votes
1answer
40 views

Cleanest way to write EntityCondition on field from widget

The widget is nodehierarchy_menu_links - it has a structure embedded in the node like: [0] -> [module] -> [menu_name] ... -> [pnid] It has more than one value as per the widget system. I ...

1 2 3 4 5 9
15 30 50 per page