default_content.module 894 Bytes
Newer Older
larowlan's avatar
larowlan committed
1 2 3 4
<?php


/**
5 6
 * Implements hook_entity_type_alter().
 * creates another node form for exporting
larowlan's avatar
larowlan committed
7
 */
8 9 10 11 12 13 14 15
function __default_content_entity_type_alter(array &$entity_types) {
  foreach ($entity_types as $entity_type_id => $entity_type) {

    if ($entity_type instanceOf Drupal\Core\Entity\ContentEntityType) {
      $entity_types[$entity_type_id]
        ->setFormClass('default_content_export', 'Drupal\default_content\ExportEntityForm');
      $entity_types[$entity_type_id]
        ->setLinkTemplate('export-form', "/$entity_type_id/{{$entity_type_id}}/export");
16
    }
larowlan's avatar
larowlan committed
17
  }
18

19 20 21 22 23 24 25 26 27 28 29 30 31
}

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