rocketship_core-8.x-2.0-alpha11/modules/rocketship_seo/rocketship_seo.install

modules/rocketship_seo/rocketship_seo.install
<?php

/**
 * @file
 * Install file.
 */

/**
 * Implements hook_install().
 */
function rocketship_seo_install() {
  // Update all roles.
  try {
    \Rocketship::updateRolePermissionsForModule('rocketship_seo');
  }
  catch (\Exception $e) {
    \Drupal::messenger()
      ->addError("Could not add permissions to existing roles. Please double-check your roles to make sure they have all needed permissions.");
  }
}

/**
 * Implements hook_requirements().
 */
function rocketship_seo_requirements($phase) {
  $requirements = [];

  if ($phase == 'runtime') {
    // Check if base URL is filled in for Simple Sitemap.
    $requirements['rocketship_seo_ss'] = [
      'title' => t('SEO: Simple Sitemap'),
      'value' => t('Base URL is filled in.'),
      'description' => t('The Simple Sitemap settings has a Base URL. Drush/external sitemap generation will work.'),
      'severity' => REQUIREMENT_OK,
    ];
    if (empty(\Drupal::config('simple_sitemap.settings')->get('base_url'))) {
      $requirements['rocketship_seo_ss'] = [
        'title' => t('SEO: Simple Sitemap'),
        'value' => t('Base URL is not filled in.'),
        'description' => t('The Simple Sitemap settings does not have a Base URL. Drush/external sitemap generation will NOT work.'),
        'severity' => REQUIREMENT_ERROR,
      ];
    }

    // Check if Pretty Paths module is installed.
    $requirements['rocketship_seo_pp'] = [
      'title' => t('SEO: Pretty Paths'),
      'value' => t('Pretty Paths is not installed.'),
      'description' => t('Using this functionality is detrimental for SEO.'),
      'severity' => REQUIREMENT_OK,
    ];
    if (\Drupal::moduleHandler()->moduleExists('facets_pretty_paths')) {
      $requirements['rocketship_seo_pp'] = [
        'title' => t('SEO: Pretty Paths'),
        'value' => t('Pretty Paths is installed.'),
        'description' => t('Please uninstall the Pretty Paths module.')
          . ' ' . t('Using this functionality is detrimental for SEO.'),
        'severity' => REQUIREMENT_ERROR,
      ];
    }
  }

  return $requirements;
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc