You are here

function emimport_import_validate in Embedded Media Field 5

File

contrib/emimport/emimport.module, line 541

Code

function emimport_import_validate($form_id, $form_values) {
  if ($form_values['op'] != t('Cancel')) {
    $parsers = $form_values['parsers'];
    foreach ($parsers as $parser) {
      $module = $parser['#module'];
      $type = $parser['#type'];
      $field = $parser['#field'];
      $value = $form_values[$field['field_name']];
      $providers = $parser['#providers'];
      $flag = FALSE;
      foreach ($providers as $provider => $info) {
        $limit = _emfield_display_limit($module, $type, $field, $provider);
        $items = emfield_include_invoke($module, $provider, 'import', $value, $limit);
        if (!empty($items)) {
          $flag = TRUE;
          break;
        }
      }
      if (!$flag) {
        form_set_error($field['field_name'], t('The @field set doesn\'t evaluate to a valid set.', array(
          '@field' => $field['widget']['label'],
        )));
      }
    }
  }
}