You are here

public static function LayoutBuilderMigration::processEntity in Panelizer 8.5

Migrates custom Panelizer layout data for a single entity.

This method is intended to be called as part of a batch operation.

Parameters

string $entity_type_id: The entity type ID.

mixed $entity_id: The ID (or revision ID, if the entity type is revisionable) of the entity to load.

See also

::buildBatch()

1 call to LayoutBuilderMigration::processEntity()
LayoutBuilderMigrationTest::testMigrateEntityWithInvalidLayout in tests/src/Functional/LayoutBuilderMigrationTest.php
Tests migrating an entity with an invalid layout plugin ID.

File

src/LayoutBuilderMigration.php, line 341

Class

LayoutBuilderMigration
Provides functionality to migrate Panelizer data to Layout Builder.

Namespace

Drupal\panelizer

Code

public static function processEntity($entity_type_id, $entity_id) {
  $storage = \Drupal::entityTypeManager()
    ->getStorage($entity_type_id);
  if ($storage
    ->getEntityType()
    ->isRevisionable()) {
    $entity = $storage
      ->loadRevision($entity_id);
  }
  else {
    $entity = $storage
      ->load($entity_id);
  }
  assert($entity instanceof FieldableEntityInterface);
  \Drupal::classResolver(static::class)
    ->doProcessEntity($entity);
}