function ContentLanguageSettings::__construct
Same name in other branches
- 9 core/modules/language/src/Entity/ContentLanguageSettings.php \Drupal\language\Entity\ContentLanguageSettings::__construct()
- 8.9.x core/modules/language/src/Entity/ContentLanguageSettings.php \Drupal\language\Entity\ContentLanguageSettings::__construct()
- 10 core/modules/language/src/Entity/ContentLanguageSettings.php \Drupal\language\Entity\ContentLanguageSettings::__construct()
Constructs a ContentLanguageSettings object.
In most cases, Field entities are created via FieldConfig::create($values), where $values is the same parameter as in this constructor.
Parameters
array $values: An array of the referring entity bundle with:
- target_entity_type_id: The entity type.
- target_bundle: The bundle.
Other array elements will be used to set the corresponding properties on the class; see the class property documentation for details.
string $entity_type: (optional) The entity type ID that is being created. Defaults to "language_content_settings".
Overrides ConfigEntityBase::__construct
File
-
core/
modules/ language/ src/ Entity/ ContentLanguageSettings.php, line 96
Class
- ContentLanguageSettings
- Defines the ContentLanguageSettings entity.
Namespace
Drupal\language\EntityCode
public function __construct(array $values, $entity_type = 'language_content_settings') {
if (empty($values['target_entity_type_id'])) {
throw new ContentLanguageSettingsException('Attempt to create content language settings without a target_entity_type_id.');
}
if (empty($values['target_bundle'])) {
throw new ContentLanguageSettingsException('Attempt to create content language settings without a target_bundle.');
}
parent::__construct($values, $entity_type);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.