繁体   English   中英

如何检查分类词汇何时更改Drupal 7

[英]How to check when taxonomy vocabulary was changed Drupal 7

我有词汇与名称dish_type,我需要明确具体的缓存,当它被保存,我试图让hook_taxonomy_overview_terms_submit()也可用于hook_taxonomy_vocabulary_update()但它没有工作。 有没有办法追踪? 请你帮忙

您是否研究过hook_taxonomy_vocabulary_presave($ vocabulary)作为可能的解决方案? 这将在您的词汇保存之前被调用,我应该认为已更新。 然后,您可以执行cache_clear_all($ cid = NULL,$ bin = NULL,$ wildcard = FALSE)。

使用hook_form_alter()在分类法添加/编辑表单上添加自定义提交处理程序。

代码示例:

function [YOUR_MOUDLE]_form_alter(&$form, &$form_state, $form_id) {
    if($form_id === 'taxonomy_form_term' && is_numeric(arg(2)) && arg(3) === 'edit') {
        $form['#submit'][] = '[YOUR_MOUDLE]_custom_submit_handler';
    }
}

function [YOUR_MOUDLE]_custom_submit_handler($form, &$form_state) {
    // Code to be executed on taxonomy update
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM