/** * {@inheritdoc} */ public static function postLoad(EntityStorageInterface $storage_controller, array &$entities) { parent::postLoad($storage_controller, $entities); foreach ($entities as $entity) { $permission = $entity->getPermissionName(); if ($permission) { $roles = array_keys(user_role_names(FALSE, $permission)); $entity->setBypassRoles($roles); } } }
/** * {@inheritdoc} */ public static function postLoad(EntityStorageInterface $storage, array &$entities) { parent::postLoad($storage, $entities); foreach ($entities as $entity) { $entity->mergeDefaultDisplaysOptions(); } }
/** * {@inheritdoc} */ 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::sort'); }
/** * {@inheritdoc} */ public static function postLoad(EntityStorageInterface $storage, array &$entities) { parent::postLoad($storage, $entities); uasort($entities, 'static::sort'); }
/** * {@inheritdoc} */ public static function postLoad(EntityStorageInterface $storage, array &$entities) { /** @var \Drupal\ctools\TypedDataResolver $resolver */ $resolver = \Drupal::service('ctools.typed_data.resolver'); /** @var \Drupal\pathauto\Entity\PathautoPattern $entity */ foreach ($entities as $entity) { foreach ($entity->getContextDefinitions() as $definition) { $context = $resolver->convertTokenToContext($definition['id'], $entity->getContexts()); $new_definition = new ContextDefinition($context->getContextDefinition()->getDataType(), $definition['label'], $context->getContextDefinition()->isRequired(), $context->getContextDefinition()->isMultiple(), $context->getContextDefinition()->getDescription(), $context->getContextDefinition()->getDefaultValue()); $new_context = new Context($new_definition, $context->hasContextValue() ? $context->getContextValue() : NULL); $entity->addContext($definition['id'], $new_context); } } parent::postLoad($storage, $entities); }