function Role::postLoad

Same name in other branches
  1. 9 core/modules/user/src/Entity/Role.php \Drupal\user\Entity\Role::postLoad()
  2. 8.9.x core/modules/user/src/Entity/Role.php \Drupal\user\Entity\Role::postLoad()
  3. 10 core/modules/user/src/Entity/Role.php \Drupal\user\Entity\Role::postLoad()

Overrides EntityBase::postLoad

File

core/modules/user/src/Entity/Role.php, line 176

Class

Role
Defines the user role entity class.

Namespace

Drupal\user\Entity

Code

public static function postLoad(EntityStorageInterface $storage, array &$entities) {
    parent::postLoad($storage, $entities);
    // Sort the queried roles by their weight.
    // See \Drupal\Core\Config\Entity\ConfigEntityBase::sort().
    uasort($entities, [
        static::class,
        'sort',
    ]);
}

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