Questions about the entity API, the API that allows to create entities in Drupal 7 and forward.
0
votes
1answer
16 views
best practice: drupal realty? [on hold]
I've googled a few existing projects...looked at code but still need to learn a lot.
More of a concept question...
I want to build a reusable module to add property management capabilities to any ...
2
votes
2answers
25 views
entity_metadata_wrapper question
I'm using this piece of code to programmatically alter a node field:
$node_wrapper = entity_metadata_wrapper('node', 93);
$node_wrapper->field_field4->set("text");
$node_wrapper->save();
...
1
vote
1answer
35 views
Implementing custom entity forms
In Making use of the admin UI, Step 3 - Implement the entity adding/editing form, it says that you need to implement "a" form with the ENTITY_TYPE_form() signature for add/edit/clone operations...
...
1
vote
0answers
17 views
EntityFieldQuery with Workflow
I need to filter an EntityFieldQuery with a given workflow state, let's say workflow it is state 21 (sid = 21). Below, the query I am using
$query_formularios_completos = new EntityFieldQuery();
...
0
votes
0answers
14 views
custom entity fields are revised
I created a custom entity with "model entities" module and I added some fields to this entity.
How can i disable field revision's for my custom entity?
0
votes
0answers
14 views
How to Display Hierarchical Vocabulary Terms in URL Pattern Separated with Slashes [duplicate]
I'm not sure if this is the appropriate place for this question (I'm a self-proclaimed newbie)...I have a vocabulary with the following scheme:
category1
subcategory1a
subcategory1b
I'm ...
0
votes
0answers
16 views
How to get access to the invoice_id programmatically
I am using the commerce invoice module(7.x-1.0-alpha3+14-dev) that generates invoice numbers, in relation to orders.
However no matter what i do I am unable to get the invoice id, so that I can use ...
0
votes
0answers
11 views
Using “Model Entities” Module and embedding add entity form
I am using "Model Entities" for creating custom entity.
How can i embed this new entity form into another page (in another module), not admin UI?
On submit I get this error "Call to undefined ...
0
votes
0answers
22 views
Using “Model Entities” Module to Create Custom Entities [duplicate]
I have been trying to use "Model Entities" to create a custom entity but I can't make it work.
First I changed file names with the new module name and then I replace every "model" with "contact" and ...
0
votes
1answer
31 views
How to add Properties to an Entity in code?
With Drupal (v7.22) I'm using the Entity Construction Kit (ECK) module (v7.x-2.0-rc2) and want to extend the sub module called 'ECK Example' that comes with it. Currently the example module just ...
1
vote
1answer
48 views
How do I provide a page manager page override for my custom entities using ctools plugins
I have a custom entity type implemented, this is essentially identical to what the Model module provides, with extra integrations.
I'm wanting to use panels and page manager to template my entity ...
0
votes
1answer
43 views
Add field to an entity_view for dispaly in a tapir table in ubercart
In the simplest terms I am trying to add a 'vendor' column to the order view table in Ubercart which will display the author of each line item product.
Below is the table of interest. I have hacked ...
0
votes
0answers
38 views
Creating an entity reference in a custom entity
I have created an entity that I want to collect data with from an external source and I want to reference that data to a node. How should i set up that entity in DB so it can properly reference a ...
0
votes
0answers
25 views
Entity types created via ECK (Entity Construction Kit) is in code or in DB?
There is a lot of great articles around creating new entity types like this
also there is module named ECK, I would like know what is the result of this?
And how is efferent from creating entity ...
0
votes
3answers
89 views
What's the easiest way to create CRUD interface for custom entities?
What is the fastest way to create admin UI for new entity type? Like at content types. I just need basic list/add/edit/delete actions.
One would think this comes with entity api?
I have found a lot ...
1
vote
1answer
45 views
How do I programmatically create an entity reference in hook_entity_info()?
Is there a way to create an entity reference in hook_entity_info? I was hoping for something like the following.
'entity keys' => array(
'id' => 'id',
'store_ref_id' => 'store_ref_id',
...
1
vote
1answer
27 views
How do I cache my custom entities using entity api with entitycache?
I have implemented custom entites, extending on Entity API. This is essentially identical to what the Model module does with a few extra customisations (fields, solr/facet integration etc).
I want to ...
3
votes
1answer
50 views
How do I make a custom entity update or create automatically update the solr index?
I have implemented a custom entity type which is essentially identical to what the Model module does, with a few additional fields.
I have followed the Apachesolr User module to understand how to ...
0
votes
0answers
35 views
field language function
I am trying to use field_language function in one of my views field templates. I need to get a language code or a fallback if its not available in the current language.
here is my code without the ...
0
votes
1answer
66 views
How do you add a conditional to check if the Node object exists?
I have the following code, but how do I add a conditional to check if the menu_get_object() is grabbing a node object or not? Im mainly using this in my contextual filter in views and its throwing an ...
0
votes
0answers
357 views
Entity Reference Module > Undefined & Non-Object Crashes
Preface
I have a fresh site install of Drupal. I'm fairly new to Drupal, but I feel rather confident with anything but module hacking right now. I've just finished about a month+ of editing and ...
0
votes
0answers
80 views
Entity Wrapper: Date field
I'm using entity_metadata_wrapper in an own module to create a node and set some values for its fields. This works fine for every field but for one. This field is a "date" field that has two values ...
0
votes
1answer
54 views
access field data in template.php and create variable for header image in page.tpl.php
I am trying to allow the user to set a custom image to display in the header on node pages that have a header_image field and to display a default header image on all other pages (including system and ...
0
votes
0answers
36 views
Get list of all entities that have a reference (via organic groups) to another entity (different bundles)
I have a "Date" entity and an "Event" entity. Dates can be linked to Events via Entity Reference using the OG Reference widget. I am having trouble getting all of the dates for a specific Event. I ...
0
votes
1answer
25 views
How should I implement an alternative file upload?
I want to write a module for Drupal 7 to integrate http://filepicker.io's awesome functionality. It's a simple JS widget that returns a URL of where the file is hosted.
I've never written a D7 module ...
0
votes
1answer
50 views
Additional fields for Ubercart uc_order_product
I need to add fields to the Ubercart entity uc_order_product. I was looking into the function field_create_instance, but don`t know exactly where to use it. I believe I should attach the field I want ...
0
votes
1answer
70 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
53 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
47 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
73 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:
...
5
votes
1answer
469 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
60 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 ...
7
votes
1answer
214 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
284 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
64 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 ...
8
votes
1answer
305 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
47 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
2answers
189 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
45 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
119 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
53 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 ...
7
votes
2answers
392 views
Accessing values of unknown field types when using entity_metadata_wrapper
I've been looking into using the Entity Metadata Wrapper classes (defined by the entity module in Drupal 7) to access field values, as this seems to be a clean way of doing so.
There a couple of ...
-2
votes
2answers
57 views
How to know node/entity ID from a submit handler?
How to know node/entity ID from a submit handler of a form created with hook_form()?
I need to make db_update() query on a single row from submit handler called by admin/structure/video/manage/% form ...
3
votes
2answers
63 views
Returning body values only
I have the following function that simply grabs nodes:
function getWords() {
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node', '=')
...
1
vote
1answer
60 views
Controller classes in Entity API
I'm trying to follow this article to build my first entity using Entity API module. I'm unclear about the dependency between controller classes and include files. If it says:
'controller class' => ...
0
votes
2answers
105 views
How do I write to location field in an Entity?
I am having a custom entity called Micronews which has a bundle microupdate created in it. I am able to write entity to db for all fields but I am not able to figure out how to write location (using ...
0
votes
1answer
288 views
Pre-populate default values into a form to edit a new entity
In a Drupal 7 site, I have created a new entity called "atomyx_portal_metadata". This entity works great in all respects. I allow people to define their own entity types (much as you can create your ...
0
votes
2answers
166 views
Remove title from hook_entity_view
I need to remove title from rendered custom entity.
unset($entity->title) is not good because i still need to use its value in this rendered entity to use in markup.
css display:none is not good ...
0
votes
0answers
39 views
Cannot get field/display options to display with entity
I've built an entity that declares a fieldable type of true, and yet when I go to a defined administration page to add a new entry, I cannot find any links pointing to the field creation prompts. I'm ...
0
votes
0answers
55 views
Implementing revisions in an entity
I'm in the process of building an entity that extends DrupalDefaultEntityController, and I have some questions about the uses of the revisions mechanism, namely if I need to duplicate all the fields ...