You are here

function pm_admin_settings_icons_path_validate in Drupal PM (Project Management) 7

Validate Icon Path form element.

Parameters

$form: Form array

$form_values: Form values

1 string reference to 'pm_admin_settings_icons_path_validate'
pm_admin_settings in ./pm.module
Defines the administration settings form for the Project Management module

File

./pm.module, line 596
Main module file for the Project Management module.

Code

function pm_admin_settings_icons_path_validate($form, $form_values) {
  $icon_path_old = variable_get('pm_icons_path', drupal_get_path('module', 'pm') . '/icons');
  $icon_path = $form_values['values']['pm_icons_path'];

  // check if directory exists
  if (!is_dir($icon_path)) {
    form_set_error('pm_icons_path', t('Icon path %path does not exist', array(
      '%path' => $icon_path,
    )));
  }
  elseif ($icon_path != $icon_path_old) {
    cache_clear_all('pm:icons', 'cache', FALSE);
  }
}