cloudinary-8.x-1.x-dev/modules/cloudinary_source_migrate/src/CloudinarySourceMigrateHelperInterface.php

modules/cloudinary_source_migrate/src/CloudinarySourceMigrateHelperInterface.php
<?php

namespace Drupal\cloudinary_source_migrate;

use Drupal\Core\Field\FieldItemBase;
use Drupal\media\MediaInterface;

/**
 * Define an interface for cloudinary source migrate helper.
 */
interface CloudinarySourceMigrateHelperInterface {

  /**
   * Define a destination map key to store values in the state.
   */
  const DESTINATION_MAP_KEY = 'cloudinary_source_migrate_destination_map';

  /**
   * Get a map of old/new bundle reference.
   *
   * @return array
   *   Key is old bundle -> value is a new bundle.
   */
  public function getMediaBundleMap(): array;

  /**
   * Get destination map.
   *
   * @return array
   *   Old media entity id -> new media entity id.
   */
  public function getDestinationMap(): array;

  /**
   * Set destination map.
   *
   * @param \Drupal\media\MediaInterface $old_media
   *   The original media entity to migrate from.
   * @param \Drupal\media\MediaInterface $new_media
   *   The new media entity, migrated one.
   */
  public function setDestinationId(MediaInterface $old_media, MediaInterface $new_media): void;

  /**
   * Clear destination map.
   */
  public function clearDestinationMap(): void;

  /**
   * Whether the media entity is already migrated.
   *
   * @param \Drupal\media\MediaInterface $media
   *   The media entity to migrate.
   *
   * @return bool
   *   TRUE if media entity is already migrated.
   */
  public function isMigrated(MediaInterface $media): bool;

  /**
   * Get public id of the asset from the field item value.
   *
   * @param \Drupal\Core\Field\FieldItemBase $item
   *   The field item object.
   *
   * @return string
   *   The public id of the asset.
   *
   * @throw \Exception
   *   Throws an exception if not applicable.
   */
  public function getPublicIdFromFieldItem(FieldItemBase $item): string;

  /**
   * Get asset data from the field item value.
   *
   * @param \Drupal\Core\Field\FieldItemBase $item
   *   The field item object.
   * @param string $resource_type
   *   The resource type.
   *
   * @return array
   *   The asset data.
   *
   * @throw \Exception
   *   Throws an exception if not applicable.
   */
  public function getAssetFromFieldItem(FieldItemBase $item, string $resource_type): array;

  /**
   * Get a list of entity reference fields to migrate.
   *
   * @return array
   *   Fields map.
   */
  public function getEntityReferenceFieldsToMigrate(): array;

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc