All Questions
22 questions with no upvoted or accepted answers
2
votes
1
answer
172
views
Custom access callbacks for user entities not being called
I'm trying to implement some custom access control for user entities, in Drupal 7.
I've used hook_entity_info_alter to set
$entity_info['user']['access callback'] = 'MYMODULE_user_access_callback';
...
2
votes
1
answer
222
views
Why xmlsitemap module implements hook_node_comment_delete this way?
Does someone know why xmlsitemap.module implements every hook_node_comment_ hooks, with a StdClass casting for the object passed in param ?
example :
/**
* Implements hook_comment_delete().
*/
...
1
vote
0
answers
33
views
How do I create field collection of/in another field collection programmatically?
How can I create field collection in another field collection using Drupal 7 Entity?
The field structure is given below;
Content type: Properties
field_1
field_2
field_collection_1 (I can create ...
1
vote
0
answers
183
views
Custom Field API with multiple values - form generates two fields by default
I have a custom field that contains couple of fields (select, textarea, text). I've implemented hook_field_widget_form like so:
I've added a field to content type and set 'Number of values' to ...
1
vote
1
answer
666
views
hook_inline_entity_form_table_fields_alter add custom field
Need some help with Inline Entity Form hook function hook_inline_entity_form_table_fields_alter.
I'm trying to add columns to the table that is visible when editing a specific node. I have been able ...
1
vote
0
answers
277
views
hook_node_presave() fired twice when adding new node
I've just noticed that hook_node_presave($node) is fired twice when adding new nodes: Once it's called from node_form_submit(); the second time from entity_save().
It turns out that $node->nid is ...
1
vote
1
answer
588
views
problems with entity translation insert hook
I'm using the entity_translation_insert() hook to set the value of a field when a node is translated.
I can successfully edit the $entity from within the implementation, but how should I save the ...
1
vote
1
answer
5k
views
How to use hook_entity_presave?
I have a product type called package. It is a package of another product type which is called applications; when a user wants to create or update a package , I want to calculate the price of the ...
0
votes
0
answers
60
views
How to use theme_file_link?
I use the webform_multiple_file for my webform. I want to display webform submissions in a custom view.
I created my views-view-fields--submissions.tpl.php and added print $fields['value_1']->...
0
votes
1
answer
35
views
How to change the saving order of field_collection fields
I have a node with field1 and field2 (field_collection)
I am using hook_entity_presave($entity, $type) like this:
function txs_entity_presave($entity, $type)
{
if ($type == '...
0
votes
1
answer
47
views
Override field module function in custom module?
I want to override field_sql_storage_field_storage_write(), defined in /modules/field/modules/field_sql_storage/field_sql_storage.module.
I tried with MYMODULE_field_storage_write_alter($entity_type, ...
0
votes
1
answer
328
views
Commerce Discount Module : Free Products : n+x
Is someone using commerce discount module and customized free products quantity field for buy x and get y functionality ? If i set buy 1 get 1(free product qty) its not multiplying while user updating ...
0
votes
1
answer
369
views
field widget is not saving selected value to database
I am creating a widget under taxonomy_term_reference field and trying to use the same autocomplete used by taxonomy module, autocomplete is working fine but data is not getting saved.
/**
* ...
0
votes
1
answer
23
views
How to set the Organic Group while saving a node based on the node's current language
We want to use a hook_node_presave to set the Organic Group (OG) field on the basic page content type based on the node's language. We have created several OGs using nodes and each one is assigned a ...
0
votes
0
answers
548
views
How to copy one field data to another and save a new revision?
We are going to remove an obsolete field(field_old) and will be using a new field (field_new) and have a need to copy the data from field_old to field_new (both text fields). Then we need to create a ...
0
votes
1
answer
31
views
How to create a module that shows some fields of profile2 type?
I want to create a module that shows some fields of profile2 type, in fact I want to show some information about any user in profile page of theme.
Profile2 type is "stores", field machine name is "...
0
votes
0
answers
32
views
It is possible to add some extra content to the rendable array of a node?
I have a hook_node_view_alter implementation in which a recive a node rendable array with its fields, data and stuff
It if possible to add like a fake field to it?
My goal is to print some data but ...
0
votes
0
answers
120
views
How i can add folder in filedepot using a custom module (without rules)
I want to create a module that adds a FileDepot folder, in this module I want the user chooses a name for the folder and I want the Parent Folder will by default "Top Level Root", I began to create ...
0
votes
1
answer
509
views
Using Entity metadata wrappers to change field value under hook_node_insert()
I am trying to change a field value inside both hook_node_insert() and hook_node_update() using EMW. It actually changes the original $node object that is passed to these hook functions but the change ...
0
votes
1
answer
68
views
Running code only once when building a form
I have built a form using the field API. The function hook_field_widget_form gets called for every field. I have a bit of code that populates a select box but it is being called for every field in the ...
0
votes
1
answer
120
views
hook_field_schema not being used
I'm trying to create a field with an additional property (or column) to define an extra relationship to a taxonomy term.
I have this in my module file:
/**
* Implements hook_field_info().
*/
...
0
votes
1
answer
143
views
(Newbie question) Something goes wrong here with db_add_field
I'm trying to adapt that D6 module to D7.
I'm on the "add afield" part of .install
Here's my code :
function node_statistics_install() {
db_add_field('accesslog', 'nid', array(
'description' ...