You are here

function module_builder_requirements in Module Builder 8.3

Implements hook_requirements().

File

./module_builder.install, line 13
module_builder.install Contains install hooks.

Code

function module_builder_requirements($phase) {
  $requirements = array();

  // Check our library is present
  if ($phase == 'install') {

    // TODO: Remove use of this wrapper, just check \DrupalCodeBuilder\Factory
    // exists.
    // Our classes aren't available in the install phase.
    // See https://www.drupal.org/node/2667588.
    require_once __DIR__ . '/src/LibraryWrapper.php';
    try {
      LibraryWrapper::loadLibrary();
    } catch (Exception $e) {
      $requirements['drupal_code_builder_library'] = array(
        'title' => t('Drupal Code Builder library'),
        'description' => t("The Drupal Code Builder library could not be found. Check README.txt for instructions."),
        'severity' => REQUIREMENT_ERROR,
      );
    }
  }
  return $requirements;
}