You are here

public function ConfigEntityBase::set in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php \Drupal\Core\Config\Entity\ConfigEntityBase::set()

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

8 calls to ConfigEntityBase::set()
ConfigEntityBase::preSave in core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
Acts on an entity before the presave hook is invoked.
EntityDisplayBase::setTargetBundle in core/lib/Drupal/Core/Entity/EntityDisplayBase.php
Sets the bundle to be displayed.
ImageStyle::setName in core/modules/image/src/Entity/ImageStyle.php
Sets the name of the image style.
Migration::set in core/modules/migrate/src/Entity/Migration.php
Sets the value of a property.
Role::setWeight in core/modules/user/src/Entity/Role.php
Sets the weight to the given value.

... See full list

1 method overrides ConfigEntityBase::set()
Migration::set in core/modules/migrate/src/Entity/Migration.php
Sets the value of a property.

File

core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php, line 168
Contains \Drupal\Core\Config\Entity\ConfigEntityBase.

Class

ConfigEntityBase
Defines a base configuration entity class.

Namespace

Drupal\Core\Config\Entity

Code

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