You are here

public function FieldStorageConfigInterface::setSettings in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/field/src/FieldStorageConfigInterface.php \Drupal\field\FieldStorageConfigInterface::setSettings()
  2. 10 core/modules/field/src/FieldStorageConfigInterface.php \Drupal\field\FieldStorageConfigInterface::setSettings()

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

1 method overrides FieldStorageConfigInterface::setSettings()
FieldStorageConfig::setSettings in core/modules/field/src/Entity/FieldStorageConfig.php
Sets field storage settings.

File

core/modules/field/src/FieldStorageConfigInterface.php, line 115

Class

FieldStorageConfigInterface
Provides an interface defining a field storage entity.

Namespace

Drupal\field

Code

public function setSettings(array $settings);