12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace Drupal\reinstall\EventSubscriber;
- use Drupal\reinstall\ReinstallEvents;
- use Drupal\reinstall\SourceEvent;
- use Symfony\Component\EventDispatcher\EventSubscriberInterface;
- class UserPreImport implements EventSubscriberInterface {
-
- public static function getSubscribedEvents() {
- return [
- ReinstallEvents::POST_SOURCE_PARSE => 'onPreImport',
- ];
- }
-
- public function onPreImport(SourceEvent $event) {
- $source = $event->source;
- if ($source->getConfiguration()['type'] !== 'user') {
- return;
- }
- $event->source->records = array_filter($event->source->records, [$this, 'filter01']);
- }
-
- public function filter01(array $record) {
- $ret = ($record['uid'] ?? 0) > 1;
- return $ret;
- }
- }
|