drupal-hooks

drupal_http_request returns error code

谁说我不能喝 提交于 2020-01-15 20:23:53
问题 I have three website Main ,a, b. If you logged in through "Main" website then i will enable session for websites "a", "b". So this is working fine. When user logged out of Main Website, i have to loggout of other two website "a", "b". There are two different logout url for the other two website so i am calling those two website's logout url in the Main website's logout function using drupal_http_request Example CODE: // this is the function where main website session are destroyed function

How to work with hook_nodeapi after image thumbnail creation with ImageCache

此生再无相见时 提交于 2019-12-25 04:43:32
问题 A bit of a followup from a previous question. As I mentioned in that question, my overall goal is to call a Ruby script after ImageCache does its magic with generating thumbnails and whatnot. Sebi's suggestion from this question involved using hook_nodeapi. Sadly, my Drupal knowledge of creating modules and/or hacking into existing modules is pretty limited. So, for this question: Should I create my own module or attempt to modify the ImageCache module? How do I go about getting the generated

Using preprocess hook on specific node type in Drupal 8

依然范特西╮ 提交于 2019-12-23 18:01:36
问题 I've had success using preprocess page hooks such as: function mytheme_preprocess_page__node_front(&$variables) { ... } and function mytheme_preprocess_page__node_12(&$variables) { ... } which correlate with custom templates named page--front.html.twig and page--12.html.twig, respectively. I'm trying to implement the same hook and template pairing for a content type called Video. I understand that there is a difference in that my examples have been custom templates for specific pages while my

Drupal: Are hook_ functions in *.api.php ever called?

故事扮演 提交于 2019-12-22 04:45:18
问题 In Drupal 7, every core module has a *.api.php file, where * is the name of the module. For example modules/node/node.api.php modules/path/path.api.php What are these files for? They contain functions that start with hook_ , and the name of a hook that (I think) the module invokes. For example modules/system/system.api has function hook_entity_view($entity, $type, $view_mode, $langcode) { $entity->content['my_additional_field'] = array( '#markup' => $additional_field, '#weight' => 10, '#theme

Send one-time login link via hook_mail

断了今生、忘了曾经 提交于 2019-12-13 17:16:31
问题 This is my first real attempt at a "module" (I recognize that this isn't something fit for contribution back to the drupal community - I'm just trying my hand at getting the APIs to do what I want.) Unfortunately, this isn't working and I'm not sure why. Wonder if anyone has any input on the approach or sees my error(s). My questions: Is there a better way to do this so I don't have to call rsvp_query() more than once? Is this a sensible approach to recursively generating an email for all

Hook perm for more than one content type

青春壹個敷衍的年華 提交于 2019-12-13 02:21:10
问题 Drupal 6.x I have this module that manages four different content types. For that matter, how do I define permission for each content within the same module? Is that even possible? I can't figure out how to define permission for each content type cuz hook_perm has to be named with module name and it doesn't have any argument(like hook_access $node) to return permission base on content type. Here's how I'd like to do - function mymodule_perm() { if(content1) return array( 'create content1 node

drupal :: order complete hook and upgrade user permission/roles

梦想的初衷 提交于 2019-12-12 11:58:06
问题 I want to be able to upgrade user's permission after the order status shows complete. I figured out that I should use hook_order hook in order to achieve that. But how do I get to know which user has created that order and how do go about updating the permissions as well as setting up the expire time for that role automatically. I want this hook to be called as soon as the payment is made and the order is completed. Any pointers will be valuable. 回答1: In the hook_order , 3 parameters are

Search hook for filtering results?

*爱你&永不变心* 提交于 2019-12-07 21:23:43
问题 I have been going through the docs and source code looking for something without luck. Is there a Drupal 6 hook that gets called after hook_search(), but before the $results gets handed off to the template system? I need to do a fairly custom pruning and reordering of results that get returned. I could just reimplement hook_search(), but this seems like overkill. Thanks. 回答1: There isn't; search_view() (which displays the results) calls search_data(), which invokes hook_search() then

Search hook for filtering results?

a 夏天 提交于 2019-12-06 07:58:09
I have been going through the docs and source code looking for something without luck. Is there a Drupal 6 hook that gets called after hook_search(), but before the $results gets handed off to the template system? I need to do a fairly custom pruning and reordering of results that get returned. I could just reimplement hook_search(), but this seems like overkill. Thanks. There isn't; search_view() (which displays the results) calls search_data() , which invokes hook_search() then immediately themes the results. Re-implementing hook_search() is probably the most straightforward route. With that

Drupal: Are hook_ functions in *.api.php ever called?

折月煮酒 提交于 2019-12-05 05:33:19
In Drupal 7, every core module has a *.api.php file, where * is the name of the module. For example modules/node/node.api.php modules/path/path.api.php What are these files for? They contain functions that start with hook_ , and the name of a hook that (I think) the module invokes. For example modules/system/system.api has function hook_entity_view($entity, $type, $view_mode, $langcode) { $entity->content['my_additional_field'] = array( '#markup' => $additional_field, '#weight' => 10, '#theme' => 'mymodule_my_additional_field', ); } There's an entity_view hook that's invoked by the system