FieldConfigInterface::setSettings

public FieldConfigInterface::setSettings(array $settings)

Sets field settings.

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

For example:

1
2
3
4
5
6
7
8
9
10
11
12
// Given these are the default settings.
$field_definition->getSettings() === [
  'fruit' => 'apple',
  'season' => 'summer',
];
// Change only the 'fruit' setting.
$field_definition->setSettings(['fruit' => 'banana']);
// The 'season' setting persists unchanged.
$field_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 field settings.

Return value

$this

File

core/lib/Drupal/Core/Field/FieldConfigInterface.php, line 82

Class

FieldConfigInterface
Defines an interface for configurable field definitions.

Namespace

Drupal\Core\Field

Code

1
public function setSettings(array $settings);
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.