You are here

function _ftools_exec_unlink in Features Tools 7.2

Execute the given unlink file

2 calls to _ftools_exec_unlink()
ftools_unlink_form_submit in ./ftools.module
@todo Please document this function.
_ftools_drush_exec_unlink_file in ./ftools.drush.inc
Executes a given unlink file

File

./ftools.module, line 332
ftools module

Code

function _ftools_exec_unlink($component) {
  $hooks = _ftools_get_hooks();
  $files = _ftools_get_unlink_files();
  include_once DRUPAL_ROOT . "/" . $files[$component]->uri;
  views_include('view');
  foreach ($hooks as $hook) {
    $function_name = str_replace('.unlink', '', $component) . "_{$hook}";
    $function_name = str_replace('.', '_', $function_name);
    if (function_exists($function_name)) {

      //@TODO: add info file so we can check if the element is in the db before trying to insert it.

      //i add a try catch block meanwhile to hide the error message.
      try {
        include_once DRUPAL_ROOT . "/" . $files[$component]->uri;
        call_user_func_array($function_name, array());
      } catch (Exception $e) {
        watchdog('ftools', "error in unlink function:" . $e
          ->getMessage());
      }
      drupal_set_message("{$hook} {$function_name}");
    }
  }
}