Projet

Général

Profil

Paste
Télécharger (1,36 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / ctools / plugins / cache / export_ui.inc @ 7e72b748

1
<?php
2

    
3
/**
4
 * @file
5
 * A caching mechanism for use with subsystems that use the export ui.
6
 */
7

    
8
$plugin = array(
9
  // cache plugins are the rare plugin types that have no real UI but
10
  // we're providing a title just in case.
11
  'title' => t('Export UI wizard cache'),
12
  'cache get' => 'ctools_cache_export_ui_cache_get',
13
  'cache set' => 'ctools_cache_export_ui_cache_set',
14
  // Some operations use a 'finalize' but that really just means set
15
  // for us, since we're not using temporary storage for subsystems.
16
  'cache finalize' => 'ctools_cache_export_ui_cache_set',
17
  // @todo The API specifications say that a 'cache clear' callback is required,
18
  // but there is none provided?
19
  // @see cache.inc
20
  // 'cache clear' => ???
21
);
22

    
23
function ctools_cache_export_ui_cache_get($plugin_name, $key) {
24
  ctools_include('export-ui');
25
  $plugin = ctools_get_export_ui($plugin_name);
26
  $handler = ctools_export_ui_get_handler($plugin);
27
  if ($handler) {
28
    $item = $handler->edit_cache_get($key);
29
    if (!$item) {
30
      $item = ctools_export_crud_load($handler->plugin['schema'], $key);
31
    }
32
    return $item;
33
  }
34
}
35

    
36
function ctools_cache_export_ui_cache_set($plugin_name, $key, $item) {
37
  ctools_include('export-ui');
38
  $plugin = ctools_get_export_ui($plugin_name);
39
  $handler = ctools_export_ui_get_handler($plugin);
40
  if ($handler) {
41
    return $handler->edit_cache_set_key($item, $key);
42
  }
43
}