You are here

protected function DomProcessBase::init in Migrate Plus 8.4

Same name and namespace in other branches
  1. 8.5 src/Plugin/migrate/process/DomProcessBase.php \Drupal\migrate_plus\Plugin\migrate\process\DomProcessBase::init()

Initialize the class properties.

Parameters

mixed $value: Process plugin value.

string $destination_property: The name of the destination being processed. Used to generate an error message.

Throws

\Drupal\migrate\MigrateSkipRowException If $value is not a \DOMDocument object.

1 call to DomProcessBase::init()
DomStrReplace::transform in src/Plugin/migrate/process/DomStrReplace.php
Performs the associated process.

File

src/Plugin/migrate/process/DomProcessBase.php, line 43

Class

DomProcessBase
Base class for process plugins that work with \DOMDocument objects.

Namespace

Drupal\migrate_plus\Plugin\migrate\process

Code

protected function init($value, $destination_property) {
  if (!$value instanceof \DOMDocument) {
    $message = sprintf('The %s plugin in the %s process pipeline requires a \\DOMDocument object. You can use the dom plugin to convert a string to \\DOMDocument.', $this
      ->getPluginId(), $destination_property);
    throw new MigrateSkipRowException($message);
  }
  $this->document = $value;
  $this->xpath = new \DOMXPath($this->document);
}