Projet

Général

Profil

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

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

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
);
18

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

    
32
function ctools_cache_export_ui_cache_set($plugin_name, $key, $item) {
33
  ctools_include('export-ui');
34
  $plugin = ctools_get_export_ui($plugin_name);
35
  $handler = ctools_export_ui_get_handler($plugin);
36
  if ($handler) {
37
    return $handler->edit_cache_set_key($item, $key);
38
  }
39
}