You are here

function minisite_validate_archive in Mini site 8

Validation callback.

Parameters

\Drupal\file\FileInterface $file: The file to validate.

string $content_extensions: String list of the allowed archive content extensions.

Return value

array Array of errors, if any.

File

./minisite.module, line 85
Main functions of the Minisite module.

Code

function minisite_validate_archive(FileInterface $file, $content_extensions) {
  $errors = [];
  try {
    Minisite::validateArchive($file, $content_extensions);
  } catch (ArchiveException $exception) {
    $errors[] = $exception
      ->getMessage();
  } catch (\Exception $exception) {
    $errors[] = t('Unable to use uploaded file as a Minisite');
  }
  return $errors;
}