public function Entity::undo in Search and Replace Scanner 8
Undo the replace operation by reverting entities to a previous revision.
Parameters
array $data: An array containing the revision ids needed to undo the previous replace operation.
Overrides ScannerPluginBase::undo
2 methods override Entity::undo()
- Node::undo in src/
Plugin/ Scanner/ Node.php - Undo the replace operation by reverting entities to a previous revision.
- Paragraph::undo in src/
Plugin/ Scanner/ Paragraph.php - Undo the replace operation by reverting entities to a previous revision.
File
- src/
Plugin/ Scanner/ Entity.php, line 107
Class
- Entity
- Class Entity.
Namespace
Drupal\scanner\Plugin\ScannerCode
public function undo(array $data) {
foreach ($data as $key => $value) {
list($entityType) = explode(':', $key);
// Attempt to load the matching plugin for the matching entity.
try {
$plugin = $this->scannerManager
->createInstance("scanner_{$entityType}");
$plugin
->undo($value);
} catch (PluginException $e) {
\Drupal::logger('scanner')
->error($e
->getMessage());
\Drupal::messenger()
->addError('An error occured: ' . $e
->getMessage());
}
}
}