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

learn more… | top users | synonyms

1
vote
1answer
11 views

Add fields to entity in module update

I'm using Drupal 7 and I have a module which has working implementation of the Entity API module. In my_module.install file there is a hook_schema() in which I defined table columns: ...
0
votes
1answer
26 views

Access menu links from a module

I'm trying to display a menu in my module. I've used \Drupal::entityManager()->getStorage('menu')->load('oz-topbar-menu'); which allows me to get the title of the menu, the description, etc. I ...
0
votes
0answers
11 views

Mailchimp subscribtion form error [on hold]

I need to use mailchimp subscription in my site. I added all the details in back-end and created a content type with mailchimp subscription field. While i am creating a content with these content ...
0
votes
1answer
26 views

Create themable field group

I have a custom entity with several fields. Now I would like to group the fields and give each group it's own twig template so that I would be able to compose a page (my custom entity) containing ...
0
votes
0answers
9 views

How to use other properties in hook_entity_property_info_alter()

I want to extend the entity properties of OG-Membership to use it as a token in rules. It works fine adding the property (for example the string 'test' as returned in the getter_callback is printed ...
-1
votes
1answer
10 views

field drag and drop is not working when adding new survey in drupal 7 [closed]

I have already installed and enabled modules survey, entity,features,form_builder and views.But When adding New survey (Structure -» Surveys->add survey) the fileds are not able to drag from palette. ...
0
votes
1answer
33 views

Adding an image base field to custom content entity

consider the following situation: I have created a custom content entity with several base fields (string and string_long fields) and it works flawlessly. In addition I want the entity to hold an ...
0
votes
0answers
6 views

entity view behaves differently

$entities = entity_load('node', array($nid)); if (!empty($entities)) { $render_array = entity_view('node', $entities, 'teaser', NULL, TRUE); print $content = ...
0
votes
1answer
16 views

Get all fields connected to an entity

I am trying to figure out the structure of a fieldable entity. I can see the main table in to install file, however it has various fields attached to it. How can I get an grand overview of the ...
0
votes
0answers
8 views

My module's custom fields are not picked up by entity_metadata_wrapper and thus Rules

The problem I have is that I am using a module called Trackfield that defined a CCK field for D6, I (inexpertly) ported the module to D7 to use the Field API. My port works great and I have been using ...
0
votes
1answer
48 views

How to save POST variables securely using entity api

I am creating a module that connects Drupal Commerce to Shipworks (a shipping management system). They communicate with each other using HTTP POSTs via a single endpoint URL on Drupal. One aspect I am ...
0
votes
0answers
47 views

How to create custom entity property display formatters

I am collaborating on a module CiviCRM Entities, which creates Drupal entities from CiviCRM 'entities', and provides access to the Drupal Entity API, manage fields and manage display, view, edit, ...
0
votes
2answers
27 views

Custom entity, entity_save() leads to PDO Exception?

I have built a custom entity called 'person'. In a module called 'beautify' I use a hook. Inside this hook I want to create an instance of this object with bundle 'person'. (entity: 'person', ...
1
vote
1answer
34 views

How i can use entity_metadata_wrapper for new database entry and update data in Drupal 7

How i can use entity_metadata_wrapper for database entry and update data in Drupal 7 I am using below code to save entry in database but not finding logic to update existing entry $node = new ...
-2
votes
1answer
29 views

How to display author name and post date in entity view page?

I am using Entity Construction Kit module. Thanks.
0
votes
2answers
24 views

Equivelant of node_type_load() for entity bundles

If I know the entity type and bundle, I want to load the bundle object with its settings. Drupal core has this for nodes, but is there any way to do it for entities? See node_type_load() in core: ...
0
votes
0answers
11 views

ECK bundle paths

I would really like to integrate the bundles I have created with ECK with other modules which offer additional functionality for entities. The problem is that when defining menu items for entities ...
0
votes
0answers
40 views

Error with EntityMetadataWrapperException

Alright, so this is common error which happens when some variable doesn't contain appropriate values/structure. There is also a backtrace if you have devel module enabled. But how do I should read ...
0
votes
0answers
12 views

Entity Class object cannot be updated

I'm using the Entity API in my module and I'm starting to feel headache with so many problems. If you think this is a duplicate of this one or this other you are wrong, just keep reading I need an ...
0
votes
1answer
52 views

Custom VBO Action to create an Entity that is referenced

I have two entities - People and People Notes. The People entity is in another database with the People Notes is in the local drupal database. Schema for People - PeopleId FirstName LastName DOB ...
0
votes
1answer
42 views

How to let user create entity objects

I am in learning phase of Drupal and ofcourse the Entity API. I have created new entity named Projects. Goal is to make a project management system for software services providers. I am actually ...
4
votes
2answers
65 views

How do I in code add new field values to a D8 content entity?

How do I in code, create a new field value, add it to a content entity, and then have it saved to the DB? Field API is dead. Long live Entity Field API! clearly shows how to read values, but doesn't ...
0
votes
0answers
8 views

What is needed for hook_field_validate to work on custom fieldable entity?

I created custom, fieldable entity, let's call it "myentity". I created myentity_form() and myentity_form_validate(). As it is explained in comments in hook_field_validate() documentation, I added to ...
0
votes
1answer
86 views

I can't set a data value using rule on a custom entity

I have created a custom entity "Project" with this fields: id, name. I have created a rule and added an action "create entity" and selected "Project". I have added another action "Set a data value" ...
0
votes
0answers
50 views

entity eck create new property type or/and behaviour

I guess everyone here has done what I want multiple times and I am probably just stupid but I can't seem to find it. So in my drupal 7 installation I want to create an entity with a date property(so ...
0
votes
0answers
11 views

How to programatically add undeletable fields to entity?

I'm creating pretty complicated system with few custom entities. Those entities will have some calculated properties, and some exposed properties - those calculated ones will be based on. I resigned ...
1
vote
0answers
30 views

Create a derived field for a custom Drupal 7 Entity for use with Views

I've created a really simple entity; basically it's for news headlines - that is, links to articles on other sites. (Using nodes would have been overkill). I've used the entity module to take care of ...
0
votes
1answer
84 views

Custom entity api admin UI overview table how to add extra columns and operations? Drupal 7

I've seen this: Custom entity operation links but it's for Drupal 8 and dealing with nodes whereas mine is a non-node type entity. So how does one go about adding stuff to the row? I want to add ...
0
votes
1answer
41 views

Custom entity api create options list for checkboxes without field api

I want to create a checkbox widget in my custom entity to select multiple options. I don't want to use the field api, instead I want to use my custom table with multiple columns, one of them shall ...
0
votes
0answers
26 views

custom entity admin page integrity constraints violation of managed_file in 'remove' process

I am developing a custom entity administrative page. The custom entity makes use of managed files. This is by storing a foreign key of file_id that references the file id in "file_managed" table. ...
1
vote
1answer
39 views

How do I update an entity?

I have defined my own entity: 'game'; created some 'games' with entity_create; and loaded one of these 'games' into a form for editing. Now, I want to update the entity with my submit handler. Here is ...
2
votes
1answer
182 views

How to get user id of order from order entity metadata wrapper

I am implementing hook_commerce_cart_line_item_refresh(). It will be receiving line item and entity metadata wrapper for the commerce order. How can I get user id of order from its metadata wrapper ...
0
votes
1answer
66 views

Show datetime value in views with entity api

I made a custom entity with a date field stored as datetime in mysql. I see the proper output in my content, and all other field values in my views except the datetme value. Only the label is shown. ...
1
vote
0answers
60 views

Cannot access empty property on entity.inc line 277 when trying to access entity add page

I created a new entity type with hook_entity_info using this code: /** * Implements hook_entity_info(). */ function custom_payment_entity_info() { return array( 'custom_payment_period' ...
0
votes
1answer
22 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
105 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
99 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
129 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
39 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
52 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
389 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
61 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
41 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
37 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
28 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
42 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
73 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( ...
1
vote
0answers
136 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
32 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
30 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 ...