You are here

defaultcontent.install in Default Content 8

Same filename and directory in other branches
  1. 7.2 defaultcontent.install
  2. 7 defaultcontent.install

File

defaultcontent.install
View source
<?php

/**
 * Implements hook_install().
 * check all existing modules for imported content()
 */
function defaultcontent_install() {
  foreach (\Drupal::moduleHandler()
    ->getModuleList() as $module => $null) {
    \Drupal::service('defaultcontent.manager')
      ->importContent($module);
  }
}

/**
 * Implements hook_modules_installed().
 * check the newly installed modules for existing content.
 */
function defaultcontent_modules_installed($modules) {

  // @todo Move this to an event once we have HookEvent.
  foreach ($modules as $module) {
    if (!\Drupal::isConfigSyncing()) {
      \Drupal::service('defaultcontent.manager')
        ->importContent($module);
    }
  }
}

Functions

Namesort descending Description
defaultcontent_install Implements hook_install(). check all existing modules for imported content()
defaultcontent_modules_installed Implements hook_modules_installed(). check the newly installed modules for existing content.