You are here

function social_node_entity_type_alter in Open Social 10.0.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_node/social_node.module \social_node_entity_type_alter()
  2. 8.8 modules/social_features/social_node/social_node.module \social_node_entity_type_alter()
  3. 10.3.x modules/social_features/social_node/social_node.module \social_node_entity_type_alter()
  4. 10.1.x modules/social_features/social_node/social_node.module \social_node_entity_type_alter()
  5. 10.2.x modules/social_features/social_node/social_node.module \social_node_entity_type_alter()

Implements hook_entity_type_alter().

File

modules/social_features/social_node/social_node.module, line 15
The social node module alterations.

Code

function social_node_entity_type_alter(array &$entity_types) {

  /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */
  if (isset($entity_types['node'])) {
    $entity_types['node']
      ->setClass(Node::class);
    $entity_types['node']
      ->setViewBuilderClass(NodeViewBuilder::class);
    foreach ([
      'default',
      'edit',
    ] as $operation) {
      $entity_types['node']
        ->setFormClass($operation, SocialNodeForm::class);
    }
  }
}