ContentLanguageSettings::loadByEntityTypeBundle

public static ContentLanguageSettings::loadByEntityTypeBundle($entity_type_id, $bundle)

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.

File

core/modules/language/src/Entity/ContentLanguageSettings.php, line 177

Class

ContentLanguageSettings
Defines the ContentLanguageSettings entity.

Namespace

Drupal\language\Entity

Code

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;
}
doc_Drupal
2016-10-29 08:57:50
Comments
Leave a Comment

Please login to continue.