You are here

function textimage_background_effect_form_validate in Textimage 7.3

Settings for 'textimage_background' image effect - form validation.

1 string reference to 'textimage_background_effect_form_validate'
textimage_background_effect_form in effects/textimage_background.inc
Settings for 'textimage_background' image effect.

File

effects/textimage_background.inc, line 283
Implementation of the 'textimage_background' image effect.

Code

function textimage_background_effect_form_validate($element, &$form_state) {
  $v =& $form_state['values']['data'];
  if ($v['background_image']['mode'] == 'select') {
    if (_textimage_get_variable('backgrounds_handling_module') == 'media') {
      if (empty($v['background_image']['fid']['fid'])) {
        form_set_error('background_image', t('Select an image, or choose another option for the background image.'));
        return;
      }
    }
    elseif (empty($v['background_image']['uri'])) {
      form_set_error('background_image', t('Select an image, or choose another option for the background image.'));
      return;
    }
  }
  if ($v['background_image']['mode'] != 'select') {
    unset($v['background_image']['fid'], $v['background_image']['uri']);
  }
  if (isset($v['background_image']['fid'])) {
    $v['background_image']['fid'] = $v['background_image']['fid']['fid'];
    $file = file_load($v['background_image']['fid']);
    $v['background_image']['uri'] = $file->uri;
  }
  if (!isset($v['background_image']['fid']) and isset($v['background_image']['uri'])) {
    $v['background_image']['uri'] = _textimage_get_variable('backgrounds_path') . '/' . $v['background_image']['uri'];
  }
  list($v['exact']['xpos'], $v['exact']['ypos']) = explode('-', $v['exact']['position']);
  unset($v['exact']['position']);
}