FieldStorageConfig::setSettings

public FieldStorageConfig::setSettings(array $settings)

Sets field storage settings.

Note that the method does not unset existing settings not specified in the incoming $settings array.

For example:

  // Given these are the default settings.
  $storage_definition->getSettings() === [
    'fruit' => 'apple',
    'season' => 'summer',
  ];
  // Change only the 'fruit' setting.
  $storage_definition->setSettings(['fruit' => 'banana']);
  // The 'season' setting persists unchanged.
  $storage_definition->getSettings() === [
    'fruit' => 'banana',
    'season' => 'summer',
  ];

For clarity, it is preferred to use setSetting() if not all available settings are supplied.

Parameters

array $settings: The array of storage settings.

Return value

$this

Overrides FieldStorageConfigInterface::setSettings

File

core/modules/field/src/Entity/FieldStorageConfig.php, line 577

Class

FieldStorageConfig
Defines the Field storage configuration entity.

Namespace

Drupal\field\Entity

Code

public function setSettings(array $settings) {
  $this->settings = $settings + $this->settings;
  return $this;
}
doc_Drupal
2016-10-29 09:12:25
Comments
Leave a Comment

Please login to continue.