public static function DateRecurItem::generateSampleValue in Recurring Dates Field 3.x
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldType/DateRecurItem.php \Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem::generateSampleValue()
- 8 src/Plugin/Field/FieldType/DateRecurItem.php \Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem::generateSampleValue()
- 3.0.x src/Plugin/Field/FieldType/DateRecurItem.php \Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem::generateSampleValue()
- 3.1.x src/Plugin/Field/FieldType/DateRecurItem.php \Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem::generateSampleValue()
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 DateRangeItem::generateSampleValue
File
- src/
Plugin/ Field/ FieldType/ DateRecurItem.php, line 468
Class
- DateRecurItem
- Plugin implementation of the 'date_recur' field type.
Namespace
Drupal\date_recur\Plugin\Field\FieldTypeCode
public static function generateSampleValue(FieldDefinitionInterface $field_definition) : array {
$values = parent::generateSampleValue($field_definition);
$timeZoneList = timezone_identifiers_list();
$values['timezone'] = $timeZoneList[array_rand($timeZoneList)];
$values['rrule'] = 'FREQ=DAILY;COUNT=' . rand(2, 10);
$values['infinite'] = FALSE;
return $values;
}