You are here

public function RestResourceConfig::__construct in Drupal 9

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

Constructs an Entity object.

Parameters

array $values: An array of values to set, keyed by property name. If the entity type has bundles, the bundle key has to be specified.

string $entity_type: The type of the entity to create.

Overrides ConfigEntityBase::__construct

File

core/modules/rest/src/Entity/RestResourceConfig.php, line 80

Class

RestResourceConfig
Defines a RestResourceConfig configuration entity class.

Namespace

Drupal\rest\Entity

Code

public function __construct(array $values, $entity_type) {
  parent::__construct($values, $entity_type);

  // The config entity id looks like the plugin id but uses __ instead of :
  // because : is not valid for config entities.
  if (!isset($this->plugin_id) && isset($this->id)) {

    // Generate plugin_id on first entity creation.
    $this->plugin_id = str_replace('.', ':', $this->id);
  }
}