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

learn more… | top users | synonyms

0
votes
2answers
20 views

Anyone manage to work entity metadata wrapper with profile2 entity?

Code: $profile = profile2_load_by_user($account); $profile = $profile['main']; $wrapper = entity_metadata_wrapper('profile2_type', $profile); ...
2
votes
0answers
27 views

Is Search API module 'English-speaking' only?

I am developing a multilingual (English-Ukrainian) Drupal website using Entity translation module. Everything went smooth before I tried to use the search module. I have Search API, Database search, ...
1
vote
1answer
28 views

Saving values of a multistep form into custom entity fields

I'm building a module that implement a multistep form based on a custom entity. The entity contains fields which are created by the install file. I was able to create the steps and if I print the ...
0
votes
0answers
9 views

Drupal modal forms -> entities

I am currently working on a project that uses ECK entities, instead of the normal Content types. I am working on a large fullcalendar implementation that has to show a Modal popup (when you click on ...
0
votes
0answers
9 views

How to add a table to a custom entity's build query

I created a new base entity type, with variations of entities that derive it. I want to override the build query in one of these variations so I may add some data from a supplemental table. My ...
0
votes
1answer
35 views

Store array values in schema field

I am creating a configuration entity for a module and in my config/schema.yml has as field as, mymodule.connection.* : type: config_entity label: SSO connection mapping: name: type: ...
0
votes
2answers
13 views

Possible to join different entity type on using EntityFieldQuery?

I am wondering whether I can use EntityFieldQuery to fetch all entities belonging to a specific content type. This entity type has a reference to another entity type. Is it possible to check against ...
0
votes
0answers
11 views

How to add a predelete hook for a custom or existing entity like commerce order?

So I am having the problem that I need to do stuff before a commerce order is deleted. On the entity api page I found a patch which somehow adds predelete hooks, or at least makes entities invoke ...
0
votes
0answers
16 views

Better way to control entity access

What is the better way to control the access of custom entities from contrib modules in Drupal? I thought 2 diferents ways: hook_menu_alter access callback and entity_info_alter access callback. Any ...
0
votes
0answers
16 views

setting up autocomplete on content type using profile2 and entityreference

so, I'm creating a content type called "elearning", and I have some modules installed: -ctools -entity api -entity reference -profile2 -views Then I create new profile called "teacher" with the ...
0
votes
1answer
48 views

Converting entity to JSON

I am quite new to Drupal and Drupal 8 so forgive me if my questions seems rather naive. I have created a custom module that creates a custom content type. I am attempting to extract those entities ...
1
vote
1answer
47 views

Does entity_save() trigger the update event?

Not quite sure if calling entity_save() from code will trigger the update event or not. So, does it? Thanks
0
votes
1answer
20 views

save base64 images alogside entity creation via services

I need to save and edit entities via services like {user, nodes, products ...etc} the problem comes with images posted form mobile apps encoded base64. I saved the file and stored the object in ...
0
votes
0answers
37 views

Saving form fields on custom entity

I'm having problems saving my custom entity to the db. I created a custom entity called 'review' using hook_entity_info() with a custom controller. I have specified some parameters in the controller ...
0
votes
0answers
9 views

clickable headers to be sorted using EntityDefaultUIController

I am showing custom rows of an entity using the Admin UI, extending the class EntityDefaultUIController with a custom class. It works really well. I can add custom headers and add data to the rows. ...
0
votes
1answer
24 views

What does exacly mean by Entity CRUD API?

Here in the documentation comment for entity_export() says: Note: Currently, this only works for entity types provided with the entity CRUD API. So, what does it actually mean? Background info: ...
0
votes
1answer
39 views

Adding referencing entities using hook_entity_property_info_alter

I have a custom entity "Matching" with a multi value field entity reference jobs that references a node of type job. function custom_alters_entity_property_info_alter(&$info) { ...
0
votes
0answers
23 views

entity_create always returns False

I'm stuck with trying to get my head around entities, and as I was following This tutorial, I ran into some troubles with this page callback method: $projects = entity_load('project', array(1, 2, ...
-1
votes
1answer
36 views

$node->toArray() don't work?

Here : How do I access a field value in a node object? Chx say : You can always do $entity->toArray() to see what's in an entity But $node->toArray(); don't work for me, why please ?
0
votes
1answer
10 views

How to create a new entity that is fieldable

I am currently learning how to create entities in Drupal 7. I have successfully defined a new entity and made it fieldable. My question is how do a create a new instance of that entity? I understand ...
0
votes
2answers
28 views

Change Views Handler for entity schema field

I want to have a numeric value in my db treated as boolean by drupal. the field is defined in the hook_schema like this 'myfield' => array( 'type' => 'int', 'unsigned' => TRUE, ...
0
votes
1answer
114 views

Node custom property exposed as extra field

I'm trying to add custom property to node bundle, my code so far: /** * Implements hook_entity_property_info_alter(). */ function mymodule_entity_property_info_alter(&$info) { $properties = ...
0
votes
1answer
60 views

Add field to existing content entity

I am trying to add a hidden field to all nodes in my module (for any node type even new ones being created later on). Would this be the correct code? $field_storage = ...
1
vote
1answer
22 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
52 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
1answer
34 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
1answer
21 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
vote
1answer
87 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
20 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
30 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
62 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
130 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
58 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
41 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
31 views

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

I am using Entity Construction Kit module. Thanks.
0
votes
2answers
28 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
19 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
121 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
14 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
71 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
53 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
70 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
11 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
124 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
79 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
15 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
39 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
172 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
70 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 ...