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

modules/rocketship_page/rocketship_page.install
<?php

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

use Drupal\search_api\Entity\Index;

/**
 * Implements hook_install().
 */
function rocketship_page_install() {

  // Update all roles.
  try {
    \Rocketship::updateRolePermissionsForModule('rocketship_page');
  }
  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.");
  }

  // Disable some blocks when this module gets installed and one of our themes
  // is already active at the time.
  $config = \Drupal::config('system.theme');
  $theme = $config->get('default');
  if (in_array($theme, ['dropsolid_starter', 'dropsolid_flex'])) {
    try {
      \Rocketship::hideBreadcrumbAndTitleBlockOnContentType($theme, 'page');
    }
    catch (\Exception $e) {
      \Drupal::messenger()
        ->addError(t('Failed hiding the breadcrumb and/or title block for the page content type. Please do so manually.'));
    }
  }

  // Load and resave the rewritten search index so it triggers
  // database updates and what not.
  $index = Index::load('content_index');
  if ($index) {
    $index->save();
  }
}

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

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