You are here

function gutenberg_entity_presave in Gutenberg 8.2

Same name and namespace in other branches
  1. 8 gutenberg.module \gutenberg_entity_presave()

Implements hook_entity_presave().

File

./gutenberg.module, line 661
Provides integration with the Gutenberg editor.

Code

function gutenberg_entity_presave($entity) {
  if (!_gutenberg_is_gutenberg_enabled($entity)) {

    // Leave early if Gutenberg is not enabled for this entity.
    return;
  }

  /* @var $mapping_fields \Drupal\gutenberg\MappingFieldsHelper */
  $mapping_fields = \Drupal::service('class_resolver')
    ->getInstanceFromDefinition(MappingFieldsHelper::class);
  $mapping_fields
    ->setFieldMappingValues($entity);
}