You are here

function ckeditor_link_revert in CKEditor Link 7.2

Same name and namespace in other branches
  1. 6.2 ckeditor_link.module \ckeditor_link_revert()
1 string reference to 'ckeditor_link_revert'
ckeditor_link_menu in ./ckeditor_link.module
Implementation of hook_menu().

File

./ckeditor_link.module, line 86
Written by Henri MEDOT <henri.medot[AT]absyx[DOT]fr> http://www.absyx.fr

Code

function ckeditor_link_revert() {
  $output = NULL;
  $args = func_get_args();
  $path = trim(implode('/', $args), '/');
  if ($path !== '') {
    $langcode = LANGUAGE_NONE;
    $path = ckeditor_link_path_strip_language($path, $langcode);
    $path = drupal_get_normal_path($path, $langcode);
    $types = ckeditor_link_get_types();
    foreach ($types as $type) {
      $func = $type['module'] . '_ckeditor_link_' . $type['type'] . '_revert';
      if (function_exists($func)) {
        $result = $func($path, $langcode);
        if ($result !== NULL) {
          $output = $result !== FALSE ? $result . ' (' . ckeditor_link_path_prefix_language($path, $langcode) . ')' : FALSE;
          break;
        }
      }
    }
  }
  drupal_add_http_header('Content-Type', 'text/javascript; charset=utf-8');
  echo drupal_json_encode($output);
}