簡體   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