function BooleanItem::generateSampleValue

Same name in other branches
  1. 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php \Drupal\Core\Field\Plugin\Field\FieldType\BooleanItem::generateSampleValue()
  2. 8.9.x core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php \Drupal\Core\Field\Plugin\Field\FieldType\BooleanItem::generateSampleValue()
  3. 10 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php \Drupal\Core\Field\Plugin\Field\FieldType\BooleanItem::generateSampleValue()

Overrides FieldItemBase::generateSampleValue

1 method overrides BooleanItem::generateSampleValue()
StatusItem::generateSampleValue in core/modules/user/src/StatusItem.php
Generates placeholder field values.

File

core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php, line 118

Class

BooleanItem
Defines the 'boolean' entity field type.

Namespace

Drupal\Core\Field\Plugin\Field\FieldType

Code

public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
    $values['value'] = mt_rand(0, 1);
    return $values;
}

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