You are here

function focal_point_test_drive_form_submit in Focal Point 7

Form submit handler for focal_point_test_drive_form().

See also

focal_point_test_drive_form()

1 string reference to 'focal_point_test_drive_form_submit'
focal_point_test_drive_form in ./focal_point.admin.inc
Form builder for the "test drive" page.

File

./focal_point.admin.inc, line 84
Functionality needed by the focal point admin pages.

Code

function focal_point_test_drive_form_submit(&$form, &$form_state) {

  // Save the test drive focal point setting.
  if (isset($form_state['values']['focal_point_test_drive_focal_point'])) {
    $old_value = variable_get('focal_point_test_drive_focal_point', FOCAL_POINT_DEFAULT);
    if ($old_value !== $form_state['values']['focal_point_test_drive_focal_point']) {
      variable_set('focal_point_test_drive_focal_point', $form_state['values']['focal_point_test_drive_focal_point']);

      // Delete old derivative images since the focal point changed.
      $fid = variable_get('focal_point_test_drive_image', NULL);
      $file = !is_null($fid) ? file_load($fid) : NULL;
      if ($file) {
        image_path_flush($file->uri);
      }
    }
  }
}