function ContentLanguageSettings::loadByEntityTypeBundle
Same name in other branches
- 9 core/modules/language/src/Entity/ContentLanguageSettings.php \Drupal\language\Entity\ContentLanguageSettings::loadByEntityTypeBundle()
- 10 core/modules/language/src/Entity/ContentLanguageSettings.php \Drupal\language\Entity\ContentLanguageSettings::loadByEntityTypeBundle()
- 11.x 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.
27 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 189
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.