Change record status: 
Project: 
Introduced in branch: 
11.5.x
Introduced in version: 
11.5.0
Description: 

ConfigEntityBase now has two new static helpers to load override free versions of their entities.

ConfigEntityBase::loadOverrideFree
ConfigEntityBase::loadMultipleOverrideFree

These will load config entities without overrides (no translations, per domain or other contextual changes) and should be used whenever a config entity is loaded for the purpose of editing/saving.

$role = Role::loadOverrideFree($id);
$role->grantPermission('access content');
$role->save();

This is equivalent to the existing method on config entity storage:

$storage = \Drupal::entityTypeManager()->getStorage('role');
assert($storage instanceof ConfigEntityStorageInterface);
$role = $storage->loadOverrideFree($id);
$role->grantPermission('access content');
$role->save();

The new method is recommended for test code and other places that do not require or can not use dependency injection.

Internally, this uses ConfigFactory::getEditable() and is the same concept.

Impacts: 
Module developers