You are here

public static function TimeZoneItem::generateSampleValue in Time Zone Field 8

Generates placeholder field values.

Useful when populating site with placeholder content during site building or profiling.

Parameters

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition.

Return value

array An associative array of values.

Overrides FieldItemBase::generateSampleValue

File

src/Plugin/Field/FieldType/TimeZoneItem.php, line 82

Class

TimeZoneItem
Plugin implementation of the time zone field type.

Namespace

Drupal\tzfield\Plugin\Field\FieldType

Code

public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
  $values['value'] = array_rand(system_time_zones());
  return $values;
}