function PreImportEvent::skip

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/DefaultContent/PreImportEvent.php \Drupal\Core\DefaultContent\PreImportEvent::skip()

Adds an entity UUID to the skip list.

Parameters

string $uuid: The UUID of an entity that should not be imported.

string|\Stringable|null $reason: (optional) A reason why the entity is being skipped. Defaults to NULL.

Throws

\InvalidArgumentException If the given UUID is not one of the ones being imported.

File

core/lib/Drupal/Core/DefaultContent/PreImportEvent.php, line 51

Class

PreImportEvent
Event dispatched before default content is imported.

Namespace

Drupal\Core\DefaultContent

Code

public function skip(string $uuid, string|\Stringable|null $reason = NULL) : void {
  if (array_key_exists($uuid, $this->finder->data)) {
    $this->skip[$uuid] = $reason;
  }
  else {
    throw new \InvalidArgumentException("Content entity '{$uuid}' cannot be skipped, because it is not one of the entities being imported.");
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.