You are here

function flash_validate in Flash Node 5

Implementation of hook_validate

File

./flash.module, line 210

Code

function flash_validate(&$node, $form) {

  // Check if file is empty
  if (empty($form['flashfile']['#value']) && empty($form['flash']['_flash']['#value'])) {
    form_set_error('flashfile', t('You must specify a Flash file to upload.'));
  }

  // check all settings have achieved a numeric value
  $settings = array(
    'height',
    'width',
    'version',
    'build',
  );
  foreach ($settings as $label) {
    if (!is_numeric($form['flash']['options'][$label]['#value']) && !empty($form['flash']['options'][$label]['#value'])) {
      form_set_error('flash][' . $label, t('You must enter a valid @label.', array(
        '@label' => $label,
      )));
    }
  }
}