integrated evenements in drupal and front
This commit is contained in:
@@ -111,6 +111,26 @@ function leshed_preprocess_field(&$variables) {
|
||||
$variables["attributes"]['class'] = [];
|
||||
}
|
||||
$variables['attributes']['class'][] = $variables['field_name'];
|
||||
|
||||
if ($variables['field_name'] === 'field_dates') {
|
||||
$field_items = $variables['element']['#items'];
|
||||
foreach ($variables['items'] as $delta => &$item) {
|
||||
$field_item = $field_items[$delta];
|
||||
foreach (['start_date', 'end_date'] as $key) {
|
||||
/** @var \Drupal\Core\Datetime\DrupalDateTime|null $date */
|
||||
$date = $field_item->{$key};
|
||||
if ($date instanceof \Drupal\Core\Datetime\DrupalDateTime) {
|
||||
$item[$key] = [
|
||||
'year' => $date->format('y'),
|
||||
'month' => $date->format('m'),
|
||||
'month_name' => $date->format('F'),
|
||||
'day' => $date->format('d'),
|
||||
'iso' => $date->format('Y-m-d\TH:i:s') . 'Z',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function leshed_preprocess_links__language_block(&$variables){
|
||||
@@ -119,3 +139,7 @@ function leshed_preprocess_links__language_block(&$variables){
|
||||
$variables['links'][$langcode]['link']['#title'] = $langcode;
|
||||
}
|
||||
}
|
||||
|
||||
function leshed_preprocess_time(&$variables){
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user