You are here

thunder_article.install in Thunder 8.2

Thunder Article install hooks.

File

modules/thunder_article/thunder_article.install
View source
<?php

/**
 * @file
 * Thunder Article install hooks.
 */

/**
 * Install the thunder article integration.
 */
function thunder_article_install() {

  // Install Shariff integration as soft dependency.
  \Drupal::service('module_installer')
    ->install([
    'shariff',
  ]);
}

/**
 * Update hook dependencies.
 *
 * 1. Dependency on Thunder Updater module.
 *
 * @return mixed
 *   Returns list of update hook dependencies.
 */
function thunder_article_update_dependencies() {
  $installThunderUpdaterHook = [
    'thunder' => 8103,
  ];
  $dependencies['thunder_article'] = [
    8101 => $installThunderUpdaterHook,
  ];
  return $dependencies;
}

/**
 * Enable thunder_paragraphs.
 */
function thunder_article_update_8001() {
  $modules = \Drupal::configFactory()
    ->getEditable('core.extension')
    ->get('module');
  $modules['thunder_paragraphs'] = 1;
  \Drupal::configFactory()
    ->getEditable('core.extension')
    ->set('module', $modules)
    ->save();
}

/**
 * Enable shariff module.
 */
function thunder_article_update_8101() {

  /** @var \Drupal\update_helper\Updater $updater */
  $updater = \Drupal::service('update_helper.updater');
  $updater
    ->executeUpdate('thunder', 'v1_1__shariff');
  return $updater
    ->logger()
    ->output();
}

/**
 * Enable length_indicator module.
 */
function thunder_article_update_8102() {

  /** @var \Drupal\update_helper\Updater $updater */
  $updater = \Drupal::service('update_helper.updater');
  $updater
    ->executeUpdate('thunder', 'thunder_article_update_8102');

  // Output logged messages to related channel of update execution.
  return $updater
    ->logger()
    ->output();
}

Functions

Namesort descending Description
thunder_article_install Install the thunder article integration.
thunder_article_update_8001 Enable thunder_paragraphs.
thunder_article_update_8101 Enable shariff module.
thunder_article_update_8102 Enable length_indicator module.
thunder_article_update_dependencies Update hook dependencies.