search_api-8.x-1.15/modules/search_api_db/search_api_db_defaults/search_api_db_defaults.install

modules/search_api_db/search_api_db_defaults/search_api_db_defaults.install
<?php

/**
 * @file
 * Install, update and uninstall functions for the DB Search Defaults module.
 */

use Drupal\search_api\IndexListBuilder;

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

  if ($phase == 'install') {
    // In case this is installed at the same time as the Search API module
    // itself, the class autoloader will not be able to find the
    // \Drupal\search_api\IndexListBuilder class on its own. Load it manually.
    if (!class_exists(IndexListBuilder::class)) {
      $search_api_path = drupal_get_path('module', 'search_api');
      require_once $search_api_path . '/src/IndexListBuilder.php';
    }

    $errors = IndexListBuilder::checkDefaultsModuleCanBeInstalled();
    foreach ($errors as $type => $error) {
      $requirements["search_api_db_defaults:$type"] = [
        'severity' => REQUIREMENT_ERROR,
        'description' => $error,
      ];
    }
  }

  return $requirements;
}

/**
 * Implements hook_install().
 */
function search_api_db_defaults_install() {
  // Clear the display plugin cache after installation so the plugin for the new
  // view (display) gets found.
  \Drupal::service('plugin.manager.search_api.display')
    ->clearCachedDefinitions();
}

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

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