public static function ContentLanguageSettings::loadByEntityTypeBundle in Drupal 9
Same name and namespace in other branches
- 8 core/modules/language/src/Entity/ContentLanguageSettings.php \Drupal\language\Entity\ContentLanguageSettings::loadByEntityTypeBundle()
Loads a content language config entity based on the entity type and bundle.
Parameters
string $entity_type_id: ID of the entity type.
string $bundle: Bundle name.
Return value
$this The content language config entity if one exists. Otherwise, returns default values.
26 calls to ContentLanguageSettings::loadByEntityTypeBundle()
- BlockContentTypeForm::form in core/
modules/ block_content/ src/ BlockContentTypeForm.php - Gets the actual form array to be built.
- CommentTypeForm::form in core/
modules/ comment/ src/ CommentTypeForm.php - Gets the actual form array to be built.
- ConfigurableLanguageManagerTest::setUp in core/
modules/ language/ tests/ src/ Functional/ ConfigurableLanguageManagerTest.php - ContentLanguageSettingsForm::buildForm in core/
modules/ language/ src/ Form/ ContentLanguageSettingsForm.php - Form constructor.
- ContentLanguageSettingsForm::submitForm in core/
modules/ language/ src/ Form/ ContentLanguageSettingsForm.php - Form submission handler.
File
- core/
modules/ language/ src/ Entity/ ContentLanguageSettings.php, line 192
Class
- ContentLanguageSettings
- Defines the ContentLanguageSettings entity.
Namespace
Drupal\language\EntityCode
public static function loadByEntityTypeBundle($entity_type_id, $bundle) {
if ($entity_type_id == NULL || $bundle == NULL) {
return NULL;
}
$config = \Drupal::entityTypeManager()
->getStorage('language_content_settings')
->load($entity_type_id . '.' . $bundle);
if ($config == NULL) {
$config = ContentLanguageSettings::create([
'target_entity_type_id' => $entity_type_id,
'target_bundle' => $bundle,
]);
}
return $config;
}