public static function ContentLanguageSettings::loadByEntityTypeBundle in Zircon Profile 8
Same name and namespace in other branches
- 8.0 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.
19 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.
- 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.
- ContentLanguageSettingsUnitTest::testLoadByEntityTypeBundle in core/
modules/ language/ tests/ src/ Unit/ ContentLanguageSettingsUnitTest.php - @covers ::loadByEntityTypeBundle
File
- core/
modules/ language/ src/ Entity/ ContentLanguageSettings.php, line 181 - Contains \Drupal\language\Entity\ContentLanguageSettings.
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::entityManager()
->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;
}