function Role::initializeIterator

Same name in other branches
  1. 9 core/modules/user/src/Plugin/migrate/source/d6/Role.php \Drupal\user\Plugin\migrate\source\d6\Role::initializeIterator()
  2. 8.9.x core/modules/user/src/Plugin/migrate/source/d6/Role.php \Drupal\user\Plugin\migrate\source\d6\Role::initializeIterator()
  3. 10 core/modules/user/src/Plugin/migrate/source/d6/Role.php \Drupal\user\Plugin\migrate\source\d6\Role::initializeIterator()

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\d6

Code

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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.