You are here

function asset_injector_requirements in Asset Injector 8

Same name and namespace in other branches
  1. 8.2 asset_injector.install \asset_injector_requirements()

Implements hook_requirements().

File

./asset_injector.install, line 11
Contains install and uninstall hooks.

Code

function asset_injector_requirements($phase) {
  $requirements = [];
  $uri = 'public://asset_injector';
  $directory = file_stream_wrapper_uri_normalize($uri);
  file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
  $requirements['asset_injector'] = [
    'title' => t('Asset Injector'),
    'value' => is_writable($directory) ? t('Directory is writable') : t('Directory not writable'),
    'description' => t('%directory should have write access.', [
      '%directory' => $directory,
    ]),
    'severity' => is_writable($directory) ? REQUIREMENT_OK : REQUIREMENT_ERROR,
  ];
  return $requirements;
}