You are here

function social_verify_custom_requirements in Open Social 8.5

Same name and namespace in other branches
  1. 8.9 social.profile \social_verify_custom_requirements()
  2. 8 social.profile \social_verify_custom_requirements()
  3. 8.2 social.profile \social_verify_custom_requirements()
  4. 8.3 social.profile \social_verify_custom_requirements()
  5. 8.4 social.profile \social_verify_custom_requirements()
  6. 8.6 social.profile \social_verify_custom_requirements()
  7. 8.7 social.profile \social_verify_custom_requirements()
  8. 8.8 social.profile \social_verify_custom_requirements()
  9. 10.3.x social.profile \social_verify_custom_requirements()
  10. 10.0.x social.profile \social_verify_custom_requirements()
  11. 10.1.x social.profile \social_verify_custom_requirements()
  12. 10.2.x social.profile \social_verify_custom_requirements()

Callback for install_verify_requirements, so that we meet custom requirement.

Parameters

array $install_state: The current install state.

Return value

array All the requirements we need to meet.

1 string reference to 'social_verify_custom_requirements'
social_install_tasks_alter in ./social.profile
Implements hook_install_tasks_alter().

File

./social.profile, line 63
Enables modules and site configuration for a social site installation.

Code

function social_verify_custom_requirements(array &$install_state) {

  // Copy pasted from install_verify_requirements().
  // @todo when composer hits remove this.
  // Check the installation requirements for Drupal and this profile.
  $requirements = install_check_requirements($install_state);

  // Verify existence of all required modules.
  $requirements += drupal_verify_profile($install_state);

  // Added a custom check for users to see if the Address libraries are
  // downloaded.
  if (!class_exists('\\CommerceGuys\\Addressing\\Address')) {
    $requirements['addressing_library'] = [
      'title' => t('Address module requirements)'),
      'value' => t('Not installed'),
      'description' => t('The Address module requires the commerceguys/addressing library. <a href=":link" target="_blank">For more information check our readme</a>', [
        ':link' => 'https://www.drupal.org/docs/8/distributions/open-social/installing-and-updating',
      ]),
      'severity' => REQUIREMENT_ERROR,
    ];
  }
  if (!class_exists('\\Facebook\\Facebook')) {
    $requirements['social_auth_facebook'] = [
      'title' => t('Social Auth Facebook module requirements'),
      'value' => t('Not installed'),
      'description' => t('Social Auth Facebook requires Facebook PHP Library. Make sure the library is installed via Composer.'),
      'severity' => REQUIREMENT_ERROR,
    ];
  }
  if (!class_exists('\\Google_Client')) {
    $requirements['social_auth_google'] = [
      'title' => t('Social Auth Google module requirements'),
      'value' => t('Not installed'),
      'description' => t('Social Auth Google requires Google_Client PHP Library. Make sure the library is installed via Composer.'),
      'severity' => REQUIREMENT_ERROR,
    ];
  }
  if (!class_exists('\\Happyr\\LinkedIn\\LinkedIn')) {
    $requirements['social_auth_linkedin'] = [
      'title' => t('Social Auth LinkedIn module requirements'),
      'value' => t('Not installed'),
      'description' => t('Social Auth LinkedIn requires LinkedIn PHP Library. Make sure the library is installed via Composer.'),
      'severity' => REQUIREMENT_ERROR,
    ];
  }
  if (!class_exists('\\Abraham\\TwitterOAuth\\TwitterOAuth')) {
    $requirements['social_auth_twitter'] = [
      'title' => t('Social Auth Twitter module requirements'),
      'value' => t('Not installed'),
      'description' => t('Social Auth Twitter requires TwitterOAuth PHP Library. Make sure the library is installed via Composer.'),
      'severity' => REQUIREMENT_ERROR,
    ];
  }
  return install_display_requirements($install_state, $requirements);
}