Projet

Général

Profil

Paste
Télécharger (2,16 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / ctools / ctools_access_ruleset / plugins / export_ui / ctools_access_ruleset_ui.class.php @ 7e72b748

1
<?php
2

    
3
class ctools_access_ruleset_ui extends ctools_export_ui {
4

    
5
  public function edit_form_context(&$form, &$form_state) {
6
    ctools_include('context-admin');
7
    ctools_context_admin_includes();
8
    ctools_add_css('ruleset');
9

    
10
    $form['right'] = array(
11
      '#prefix' => '<div class="ctools-right-container">',
12
      '#suffix' => '</div>',
13
    );
14

    
15
    $form['left'] = array(
16
      '#prefix' => '<div class="ctools-left-container clearfix">',
17
      '#suffix' => '</div>',
18
    );
19

    
20
    // Set this up and we can use CTools' Export UI's built in wizard caching,
21
    // which already has callbacks for the context cache under this name.
22
    $module = 'export_ui::' . $this->plugin['name'];
23
    $name = $this->edit_cache_get_key($form_state['item'], $form_state['form type']);
24

    
25
    ctools_context_add_context_form($module, $form, $form_state, $form['right']['contexts_table'], $form_state['item'], $name);
26
    ctools_context_add_required_context_form($module, $form, $form_state, $form['left']['required_contexts_table'], $form_state['item'], $name);
27
    ctools_context_add_relationship_form($module, $form, $form_state, $form['right']['relationships_table'], $form_state['item'], $name);
28
  }
29

    
30
  public function edit_form_rules(&$form, &$form_state) {
31
    // The 'access' UI passes everything via $form_state, unlike the 'context' UI.
32
    // The main difference is that one is about 3 years newer than the other.
33
    ctools_include('context');
34
    ctools_include('context-access-admin');
35

    
36
    $form_state['access'] = $form_state['item']->access;
37
    $form_state['contexts'] = ctools_context_load_contexts($form_state['item']);
38

    
39
    $form_state['module'] = 'ctools_export_ui';
40
    $form_state['callback argument'] = $form_state['object']->plugin['name'] . ':' . $form_state['object']->edit_cache_get_key($form_state['item'], $form_state['form type']);
41
    $form_state['no buttons'] = TRUE;
42

    
43
    $form = ctools_access_admin_form($form, $form_state);
44
  }
45

    
46
  public function edit_form_rules_submit(&$form, &$form_state) {
47
    $form_state['item']->access['logic'] = $form_state['values']['logic'];
48
  }
49

    
50
  public function edit_form_submit(&$form, &$form_state) {
51
    parent::edit_form_submit($form, $form_state);
52
  }
53

    
54
}