You are here

function node_gallery_relationship_content_types_form_validate in Node Gallery 6.3

Validation callback for the relationship form.

_state

Parameters

$form:

File

./node_gallery.admin.inc, line 423

Code

function node_gallery_relationship_content_types_form_validate($form, &$form_state) {
  $gallery_type = $form_state['values']['relationship']['gallery_type'];
  $image_type = $form_state['values']['relationship']['image_type'];
  if ($gallery_type == $image_type) {
    form_set_error('Type', t("The gallery type and image type can't be the same."));
  }
  if (($r = node_gallery_get_relationship($gallery_type)) && $r['rid'] != $form['#relationship']['rid']) {
    form_set_error('relationship][gallery_type', t('The !gallery_type type is already part of a relationship.', array(
      '!gallery_type' => $gallery_type,
    )));
  }
  if (($r = node_gallery_get_relationship(NULL, $image_type)) && $r['rid'] != $form['#relationship']['rid']) {
    form_set_error('relationship][image_type', t('The !image_type type is already part of a relationship.', array(
      '!image_type' => $image_type,
    )));
  }
}