module
iftra_group_breadcrumbs.module
/**
* Implements hook_theme_registry_alter().
*/
function hook_theme_registry_alter(&$theme_registry) {
// Kill the gin breadcrumb preprocessor, since we do our own backend
// breadcrumb logic.
foreach ($theme_registry['breadcrumb']['preprocess functions'] as $key => $value) {
if ($value == 'gin_preprocess_breadcrumb') {
unset($theme_registry['breadcrumb']['preprocess functions'][$key]);
}
}
}
17.08.2022 | Pascal Crott
iftra_group_breadcrumbs.module
my_module.module
// Get DrupalDateTime object with current date & time (timezone from system is used).
$current_date = new DrupalDateTime();
// Get DrupalDateTime object with the value from a field of type date (timezone from system is used).
$deadline = $entity->field_date->date;
// Change timezone to 'UTC' (just for demo/devbit purpose).
$freelancer_dl->setTimezone(new DateTimeZone('UTC'));
$current_date->setTimezone(new DateTimeZone('UTC'));
// Format DrupalDateTime object (just for demo/devbit purpose).
$freelancer_dl->format(\Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface::DATETIME_STORAGE_FORMAT);
$current_date->format(\Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface::DATETIME_STORAGE_FORMAT);
// Modify DrupalDateTime object.
$deadline->modify('-2 Days');
// You can compare the DrupalDateTime objects.
if ($deadline <= $current_date) {
//...do something...
}
07.06.2022 | Fabian Alleblas