You are here

function elfinder_ffsel_elfinder_js_settings in elFinder file manager 7

Same name and namespace in other branches
  1. 8.2 modules/elfinder_ffsel/elfinder_ffsel.module \elfinder_ffsel_elfinder_js_settings()
  2. 6.2 modules/elfinder_ffsel/elfinder_ffsel.module \elfinder_ffsel_elfinder_js_settings()
  3. 6 modules/elfinder_ffsel/elfinder_ffsel.module \elfinder_ffsel_elfinder_js_settings()
  4. 7.3 modules/elfinder_ffsel/elfinder_ffsel.module \elfinder_ffsel_elfinder_js_settings()
  5. 7.2 modules/elfinder_ffsel/elfinder_ffsel.module \elfinder_ffsel_elfinder_js_settings()

Implementation of hook_elfinder_js_settings

File

modules/elfinder_ffsel/elfinder_ffsel.module, line 197

Code

function elfinder_ffsel_elfinder_js_settings($settings) {

  /* for filefield_sources support */
  if ($settings['editorApp'] == 'ffs') {
    $settings['connectorUrl'] = url('elfinder/connector/relative');
    if (isset($_GET['field_name'])) {
      if (preg_match("/^[a-zA-z0-9_-]+\$/", $_GET['field_name'])) {
        $settings['field_name'] = $_GET['field_name'];
      }
    }
    if (isset($_GET['filepath_id'])) {
      if (preg_match("/^[a-zA-z0-9_-]+\$/", $_GET['filepath_id'])) {
        $settings['filepath_id'] = $_GET['filepath_id'];
      }
    }
    drupal_add_js(drupal_get_path('module', 'elfinder_ffsel') . '/ffs.callback.js');
    $settings['editorCallback'] = 'elfinder_ffs_callback';
  }
  return $settings;
}