You are here

function finder_i18nstrings_finderapi in Finder 6

Same name and namespace in other branches
  1. 7 modules/finder_i18nstrings/finder_i18nstrings.module \finder_i18nstrings_finderapi()

Implementation of hook_finderapi().

File

modules/finder_i18nstrings/finder_i18nstrings.module, line 83
The finder string translation module.

Code

function finder_i18nstrings_finderapi(&$object, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'finder_block':
    case 'finder_view':
      $finder =& $object;
      if (!empty($finder->settings['i18nstrings'])) {
        $map =& $finder->settings['i18nstrings'];
        finder_i18nstrings_translate_strings($finder, $map);
        if (is_array($finder->elements)) {
          foreach ($finder->elements as $key => $element) {
            $map =& $element->settings['i18nstrings'];
            finder_i18nstrings_translate_strings($element, $map);
            $finder->elements[$key] = $element;
          }
        }
      }
      return;
    case 'finder_presave':
    case 'finder_element_presave':
      if (isset($object->settings)) {
        $object->settings['i18nstrings'] = finder_i18nstrings_map($object);
      }
      return;
    case 'finder_insert':
    case 'finder_update':
    case 'finder_element_insert':
    case 'finder_element_update':
      if (!empty($object->settings['i18nstrings'])) {
        $map =& $object->settings['i18nstrings'];
        finder_i18nstrings_save_strings($object, $map);
      }
      return;
    case 'finder_delete':
    case 'finder_element_delete':
      $map = finder_i18nstrings_map($object);
      finder_i18nstrings_delete_strings($object, $map);
      return;
  }
}