ConfigEntityBase::set

public ConfigEntityBase::set($property_name, $value)

Sets the value of a property.

Parameters

string $property_name: The name of the property that should be set.

mixed $value: The value the property should be set to.

Return value

$this

Overrides ConfigEntityInterface::set

File

core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php, line 164

Class

ConfigEntityBase
Defines a base configuration entity class.

Namespace

Drupal\Core\Config\Entity

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
public function set($property_name, $value) {
  if ($this instanceof EntityWithPluginCollectionInterface) {
    $plugin_collections = $this->getPluginCollections();
    if (isset($plugin_collections[$property_name])) {
      // If external code updates the settings, pass it along to the plugin.
      $plugin_collections[$property_name]->setConfiguration($value);
    }
  }
 
  $this->{$property_name} = $value;
 
  return $this;
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.