Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EntityExists.php

function EntityExists::transform

Overrides ProcessPluginBase::transform

File

core/modules/migrate/src/Plugin/migrate/process/EntityExists.php, line 68

Class

EntityExists
This plugin checks if a given entity exists.

Namespace

Drupal\migrate\Plugin\migrate\process

Code

public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
    if (is_array($value)) {
        $value = reset($value);
    }
    $entity = $this->storage
        ->load($value);
    if ($entity instanceof EntityInterface) {
        return $entity->id();
    }
    return FALSE;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal