date_time_day.install in Date time day 8
Update hooks for the Date time day module.
File
date_time_day.installView source
<?php
/**
* @file
* Update hooks for the Date time day module.
*/
use Drupal\datetime\Plugin\Field\FieldType\DateTimeItem;
use Drupal\field\Entity\FieldStorageConfig;
/**
* Update the changed field storage settings for existing fields.
*/
function date_time_day_update_8106(&$sandbox) {
$storage_configs = FieldStorageConfig::loadMultiple();
foreach ($storage_configs as $storage_name => $storage_config) {
if ($storage_config
->getType() !== 'datetimeday') {
continue;
}
$storage_config
->setSetting('time_type', $storage_config
->getSetting('datetime_type'));
$storage_config
->setSetting('datetime_type', DateTimeItem::DATETIME_TYPE_DATE);
$storage_config
->save();
}
}
Functions
Name | Description |
---|---|
date_time_day_update_8106 | Update the changed field storage settings for existing fields. |