• revision in drupal


    db_query('DELETE FROM {node_revisions} nr WHERE nr.vid NOT IN (SELECT n.vid FROM {node} n)');
    You don't want to delete all the revisions: You want to delete all but the current revision.

    在content-type-form里面有个选项create a new revision 如果选择了这个 则每次修改node的时候 都会生成一个新的node revision

    也有这样的选择

    function YOUR_MODULE_form_alter(&$form, &$form_state, $form_id) {
        //drupal_set_message("Form ID is : " . $form_id);
        switch($form_id) {
            case 'CONTENT_TYPE_node_form':
                //dpm($form);
                $form['actions']['submit']['#submit'][] = 'revision_control_node_form_submit';
                $form['actions']['submit']['#submit'] = array_reverse($form['actions']['submit']['#submit']); // reverse array to put our submit handler first
                break;
        }
    
    }
    function revision_control_node_form_submit($form, &$form_state) {
        if($form_state['values']['your_taxonomy_field'] == 'your_value') {
            $form_state->revision = 1;
        }
    }
    http://stackoverflow.com/questions/21451567/how-to-enable-disable-revision-in-drupal-7

     

  • 相关阅读:
    阿里云配置mysql远程连接
    [转载]Lodop用户应对谷歌浏览器停用Plugin技术的处理办法
    利用lodop打印控件轻松实现批量打印
    ThinkPHP 中M方法和D方法的具体区别
    Codeforces
    POJ
    HDU
    POJ
    POJ
    HDU
  • 原文地址:https://www.cnblogs.com/qinqiu/p/4958528.html
Copyright © 2020-2023  润新知