You are here

function _itoggle_admin_check_plugin_path in iToggle 7

Checks if the directory in $form_element exists and contains a file named 'engage.itoggle.js'. If validation fails, the form element is flagged with an error from within the file_check_directory function.

This was borrowed from the Colorbox module

@link http://drupal.org/project/colorbox

Parameters

$form_element: The form element containing the name of the directory to check.

1 string reference to '_itoggle_admin_check_plugin_path'
itoggle_form_admin in includes/itoggle.admin.inc
@file iToggle Admin config pages.

File

includes/itoggle.admin.inc, line 150
iToggle Admin config pages.

Code

function _itoggle_admin_check_plugin_path($form_element) {
  $library_path = $form_element['#value'];
  if (!is_dir($library_path) || !(file_exists($library_path . '/engage.itoggle.js') && file_exists($library_path . '/engage.itoggle-min.js'))) {
    form_set_error($form_element['#parents'][0], t('You need to download the !itoggle and extract the entire contents of the archive into the %path folder of your server.', array(
      '!itoggle' => l(t('iToggle plugin'), 'http://labs.engageinteractive.co.uk/itoggle/'),
      '%path' => $library_path,
    )));
  }
  return $form_element;
}