function DataDefinition::setSetting

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/TypedData/DataDefinition.php \Drupal\Core\TypedData\DataDefinition::setSetting()
  2. 10 core/lib/Drupal/Core/TypedData/DataDefinition.php \Drupal\Core\TypedData\DataDefinition::setSetting()
  3. 11.x core/lib/Drupal/Core/TypedData/DataDefinition.php \Drupal\Core\TypedData\DataDefinition::setSetting()

Sets a definition setting.

Parameters

string $setting_name: The definition setting to set.

mixed $value: The value to set.

Return value

static The object itself for chaining.

2 methods override DataDefinition::setSetting()
BaseFieldDefinition::setSetting in core/lib/Drupal/Core/Field/BaseFieldDefinition.php
Sets a definition setting.
FieldDefinition::setSetting in core/lib/Drupal/Core/Field/FieldDefinition.php
Sets a definition setting.

File

core/lib/Drupal/Core/TypedData/DataDefinition.php, line 253

Class

DataDefinition
A typed data definition class for defining data based on defined data types.

Namespace

Drupal\Core\TypedData

Code

public function setSetting($setting_name, $value) {
    $this->definition['settings'][$setting_name] = $value;
    return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.