entity_meta_relation-8.x-1.0-beta8/modules/emr_node/emr_node.module
modules/emr_node/emr_node.module
<?php
/**
* @file
* Entity meta relation node module file.
*/
declare(strict_types=1);
use Drupal\emr_node\NodeFormHandler;
/**
* Implements hook_entity_type_alter().
*/
function emr_node_entity_type_alter(array &$entity_types) {
if (!isset($entity_types['node'])) {
return;
}
/** @var \Drupal\Core\Entity\EntityTypeInterface $entity_type */
$entity_type = $entity_types['node'];
if (!$entity_type->hasHandlerClass('emr_content_form')) {
// Add the entity meta content form handler to the Node entity type.
$entity_type->setHandlerClass('emr_content_form', NodeFormHandler::class);
}
// Set the EntityMetaRelation entity bundle that is used to connect the
// Node entity type with the EntityMeta entity.
$entity_type->set('entity_meta_relation_bundle', 'node_meta_relation');
// Set the field name used to reference the Node entity revision on the
// EntityMetaRelation entity that connects it to an EntityMeta.
$entity_type->set('entity_meta_relation_content_field', 'emr_node_revision');
// Set the field name used to reference the EntityMeta entity revision from
// the EntityMetaRelation entity that connects it to a Node.
$entity_type->set('entity_meta_relation_meta_field', 'emr_meta_revision');
}
