You are here

function flashnode_validate in Flash Node 6.2

Same name and namespace in other branches
  1. 5.6 flashnode.module \flashnode_validate()
  2. 5.2 flashnode.module \flashnode_validate()
  3. 5.3 flashnode.module \flashnode_validate()
  4. 6.3 flashnode.module \flashnode_validate()

Implementation of hook_validate

File

./flashnode.module, line 164

Code

function flashnode_validate(&$node) {

  // Check a file has been uploaded
  if (!$_FILES['files']['name']['flashfile'] && !$node->flashnode['filepath']) {
    form_set_error('flashfile', t('You must upload a file.'));
  }

  // Check width is valid (if not empty it must be numeric)
  if (!empty($node->flashnode['width']) && !is_numeric($node->flashnode['width'])) {
    form_set_error('flashnode][width', t('You must enter a valid width.'));
  }

  // Check height is valid (if not empty it must be numeric)
  if (!empty($node->flashnode['height']) && !is_numeric($node->flashnode['height'])) {
    form_set_error('flashnode][height', t('You must enter a valid height.'));
  }
  return;
}