DomRemove.php in Migrate Plus 8.5
File
src/Plugin/migrate/process/DomRemove.php
View source
<?php
namespace Drupal\migrate_plus\Plugin\migrate\process;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Row;
use Drupal\migrate_plus\Plugin\migrate\process\DomProcessBase;
class DomRemove extends DomProcessBase {
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
$this
->init($value, $destination_property);
$walking_dead = [];
foreach ($this->xpath
->query($this->configuration['selector']) as $node) {
if (isset($this->configuration['limit']) && count($walking_dead) >= $this->configuration['limit']) {
break;
}
$walking_dead[] = $node;
}
foreach ($walking_dead as $node) {
$node->parentNode
->removeChild($node);
}
return $this->document;
}
}
Classes
Name |
Description |
DomRemove |
Remove nodes from a DOMDocument object. |