Hook entity insert (Drupal): verschil tussen versies
Naar navigatie springen
Naar zoeken springen
(Nieuwe pagina aangemaakt met '''hook_entity_insert'' is een generieke hook die voor alles en nog wat handig is, bv. als een nieuwe order in Drupal Commerce is ingegeven (omdat er geen specifieke...') |
|||
Regel 1: | Regel 1: | ||
− | ''hook_entity_insert'' is een generieke hook die voor alles en nog wat handig is, bv. als een nieuwe order in Drupal Commerce is ingegeven (omdat er geen specifieker event bestaat). | + | ''hook_entity_insert'' is een generieke hook die voor alles en nog wat handig is, bv. als een nieuwe order in Drupal Commerce is ingegeven (omdat er geen specifieker event bestaat). Vooralsnog krijg ik 'm alleen niet aan de praat |
+ | == Casus == | ||
+ | |||
+ | Om 'm te testen gebruik ik deze code: | ||
+ | |||
+ | <pre> | ||
+ | // entity_insert | ||
+ | ///////////////////////////////////////////// | ||
+ | // | ||
+ | function commerce_adwords_entity_insert($entity, $type) | ||
+ | { | ||
+ | print "<br><br><br> entity_insert"; | ||
+ | print phpinfo(); | ||
+ | } | ||
+ | |||
+ | // Overige events | ||
+ | ///////////////////////////////////////////// | ||
+ | // | ||
+ | function commerce_adwords_commerce_order_presave($order) | ||
+ | { | ||
+ | print "<br><br><br> commerce_order_presave"; | ||
+ | // print phpinfo(); | ||
+ | } | ||
+ | |||
+ | function commerce_adwords_order_state_info() | ||
+ | { | ||
+ | print "<br><br><br> commerce_adwords_commerce_order_presave - Sla nieuwe order op "; | ||
+ | // print phpinfo(); | ||
+ | } | ||
+ | |||
+ | function commerce_adwords_entity_presave() | ||
+ | { | ||
+ | print "<br><br><br> entity_presave"; | ||
+ | // print phpinfo(); | ||
+ | } | ||
+ | |||
+ | |||
+ | function commerce_adwords_entity_update($entity, $type) | ||
+ | { | ||
+ | print "<br><br><br> entity_update"; | ||
+ | // print phpinfo(); | ||
+ | } | ||
+ | |||
+ | function commerce_adwords_commerce_order_status_update() | ||
+ | { | ||
+ | print "<br><br><br> commerce_order_status_update"; | ||
+ | // print phpinfo(); | ||
+ | } | ||
+ | |||
+ | function commerce_adwords_commerce_order_status_info() | ||
+ | { | ||
+ | print "<br><br><br> commerce_order_status_info"; | ||
+ | // print phpinfo(); | ||
+ | } | ||
+ | |||
+ | function commerce_adwords_commerce_checkout_complete() | ||
+ | { | ||
+ | print "<br><br><br> commerce_checkout_complete"; | ||
+ | // print phpinfo(); | ||
+ | } | ||
+ | |||
+ | function commerce_adwords_init() | ||
+ | { | ||
+ | if (arg(0)=='checkout' && arg(2)=='complete') | ||
+ | { | ||
+ | print "<br><br><br> commerce_adwords_init - checkout-completed-page<br>"; | ||
+ | } | ||
+ | } | ||
+ | </pre> | ||
== Syntaxis == | == Syntaxis == | ||
+ | |||
+ | |||
Versie van 3 dec 2016 15:53
hook_entity_insert is een generieke hook die voor alles en nog wat handig is, bv. als een nieuwe order in Drupal Commerce is ingegeven (omdat er geen specifieker event bestaat). Vooralsnog krijg ik 'm alleen niet aan de praat
Casus
Om 'm te testen gebruik ik deze code:
// entity_insert ///////////////////////////////////////////// // function commerce_adwords_entity_insert($entity, $type) { print "<br><br><br> entity_insert"; print phpinfo(); } // Overige events ///////////////////////////////////////////// // function commerce_adwords_commerce_order_presave($order) { print "<br><br><br> commerce_order_presave"; // print phpinfo(); } function commerce_adwords_order_state_info() { print "<br><br><br> commerce_adwords_commerce_order_presave - Sla nieuwe order op "; // print phpinfo(); } function commerce_adwords_entity_presave() { print "<br><br><br> entity_presave"; // print phpinfo(); } function commerce_adwords_entity_update($entity, $type) { print "<br><br><br> entity_update"; // print phpinfo(); } function commerce_adwords_commerce_order_status_update() { print "<br><br><br> commerce_order_status_update"; // print phpinfo(); } function commerce_adwords_commerce_order_status_info() { print "<br><br><br> commerce_order_status_info"; // print phpinfo(); } function commerce_adwords_commerce_checkout_complete() { print "<br><br><br> commerce_checkout_complete"; // print phpinfo(); } function commerce_adwords_init() { if (arg(0)=='checkout' && arg(2)=='complete') { print "<br><br><br> commerce_adwords_init - checkout-completed-page<br>"; } }