You are here

function deploy_entity_type_alter in Deploy - Content Staging 8

Implements hook_entity_type_alter().

File

./deploy.module, line 62
UI module to deploy content entities.

Code

function deploy_entity_type_alter(array &$entity_types) {
  if (!empty($entity_types['replication'])) {

    /** @var \Drupal\Core\Entity\EntityTypeInterface $replication */
    $replication = $entity_types['replication'];
    $replication
      ->setHandlerClass('list_builder', 'Drupal\\deploy\\ReplicationListBuilder');
    $replication
      ->setHandlerClass('access', 'Drupal\\deploy\\ReplicationAccessControlHandler');
    $replication
      ->setHandlerClass('route_provider', [
      'html' => 'Drupal\\Core\\Entity\\Routing\\AdminHtmlRouteProvider',
    ]);
    $replication
      ->setHandlerClass('form', [
      'default' => 'Drupal\\deploy\\Entity\\Form\\ReplicationForm',
      'add' => 'Drupal\\deploy\\Entity\\Form\\ReplicationForm',
      'delete' => 'Drupal\\deploy\\Entity\\Form\\ReplicationDeleteForm',
    ]);
    $replication
      ->setLinkTemplate('collection', '/admin/structure/deployment');
    $replication
      ->setLinkTemplate('delete-form', '/admin/structure/deployment/{replication}/delete');
    $replication
      ->set('field_ui_base_route', 'entity.replication.collection');
    $replication
      ->set('admin_permission', 'administer workspaces');
  }
}