protected function Role::initializeIterator in Drupal 10
Same name and namespace in other branches
- 8 core/modules/user/src/Plugin/migrate/source/d6/Role.php \Drupal\user\Plugin\migrate\source\d6\Role::initializeIterator()
- 9 core/modules/user/src/Plugin/migrate/source/d6/Role.php \Drupal\user\Plugin\migrate\source\d6\Role::initializeIterator()
Initializes the iterator with the source data.
Return value
\Iterator Returns an iterable object of data for this source.
Overrides SqlBase::initializeIterator
File
- core/
modules/ user/ src/ Plugin/ migrate/ source/ d6/ Role.php, line 53
Class
- Role
- Drupal 6 role source from database.
Namespace
Drupal\user\Plugin\migrate\source\d6Code
protected function initializeIterator() {
$filter_roles = $this
->select('filter_formats', 'f')
->fields('f', [
'format',
'roles',
])
->execute()
->fetchAllKeyed();
foreach ($filter_roles as $format => $roles) {
// Drupal 6 code: $roles = ','. implode(',', $roles) .',';
// Remove the beginning and ending comma.
foreach (explode(',', trim($roles, ',')) as $rid) {
$this->filterPermissions[$rid][] = $format;
}
}
return parent::initializeIterator();
}