You are here

public function ContentLanguageSettings::__construct in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/language/src/Entity/ContentLanguageSettings.php \Drupal\language\Entity\ContentLanguageSettings::__construct()

Constructs a ContentLanguageSettings object.

In most cases, Field entities are created via entity_create('field_config', $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.

Overrides ConfigEntityBase::__construct

See also

entity_create()

File

core/modules/language/src/Entity/ContentLanguageSettings.php, line 82
Contains \Drupal\language\Entity\ContentLanguageSettings.

Class

ContentLanguageSettings
Defines the ContentLanguageSettings entity.

Namespace

Drupal\language\Entity

Code

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);
}