1

I've seen other posts and did all the good things, I think... still not firing.

I use Commerce Kickstart 2 in Drupal 7

I want my module to be called for the hook_entity_presave event.

I followed the docs to create my custom module: call it 'Update Description' I put my new mod in sites/all/modules/update_description

update_description.info
update_description.module

I named the files and added the appropriate info

name = Update Description
description = This module populates a description field based on the selected product attributes. 
core = 7.x

I see, and enabled the module in the modules list, and I cleared cache

The module looks for a type of entity, and updates it:

function update_description_hook_entity_presave($entity, $type){
    $entity->changed = REQUEST_TIME;
    $vari_result = "";

    watchdog('update_description', 'type: ' . $entity->type, array(), WATCHDOG_DEBUG, NULL);

    if($entity->type == 'my_new_content_type' && $entity->product_id && $entity->revision_id) {
        // do stuff
        /// watchdog the results
    }
}

But I never see any log messages show up when I create or update an item of 'my_new_content_type', other than the default creation 'info' log message that happens anyway.

What do I need to do to get this my module to 'hook' into this call?

1 Answer 1

2

The hook_ part is for example only; it should be replaced completely by your module's name:

function update_description_entity_presave($entity, $type) {
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.