You are here

content_synchronizer.module in Content Synchronizer 8

Same filename and directory in other branches
  1. 8.2 content_synchronizer.module
  2. 3.x content_synchronizer.module

Hooks definitions for content_synchronizer module.

File

content_synchronizer.module
View source
<?php

/**
 * @file
 * Hooks definitions for content_synchronizer module.
 */
use Drupal\content_synchronizer\Service\EntityExportFormBuilder;
use Drupal\Core\Form\FormStateInterface;
use Drupal\content_synchronizer\Service\ExportManager;
use Drupal\content_synchronizer\Service\GlobalReferenceManager;
use Drupal\Core\Entity\EntityInterface;
use Drupal\content_synchronizer\Service\ArchiveDownloader;

/**
 * Implements hook_theme().
 */
function content_synchronizer_theme($existing, $type, $theme, $path) {
  $items = [
    'entities_list_table' => [
      'variables' => [
        'entities' => NULL,
        'title' => NULL,
        'checkbox_name' => NULL,
        'status_or_bundle' => NULL,
      ],
    ],
  ];
  return $items;
}

/**
 * Implements hook_form_alter().
 */
function content_synchronizer_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  \Drupal::service(EntityExportFormBuilder::SERVICE_NAME)
    ->addExportFields($form, $form_state);
}

/**
 * Implements hook_entity_delete().
 */
function content_synchronizer_entity_delete(EntityInterface $entity) {
  \Drupal::service(GlobalReferenceManager::SERVICE_NAME)
    ->onEntityDelete($entity);
  \Drupal::service(ExportManager::SERVICE_NAME)
    ->onEntityDelete($entity);
}

/**
 * Implements hook_preprocess().
 */
function content_synchronizer_preprocess_page(&$vars) {
  \Drupal::service(ArchiveDownloader::SERVICE_NAME)
    ->donwloadArchive($vars);
}