I'm trying to hook into the 'date_default' formatter (it's really nice, that this is possible via the drupal_alter() functionality in the code).

However, in hook_formatter_date_formatter_pre_view_alter() it is not possible to edit the $items, since it is implemented like this (where $variables['items'] is a copy of the 'real' $items array):
drupal_alter('date_formatter_pre_view', $entity, $variables);

So far, I have altered the code like this to make it possible to edit the $items:
drupal_alter('date_formatter_pre_view', $entity, $variables, $items);

In my concrete example I would like to add the option to only show upcoming dates. However, this is currently not possible.
What is the rationality for not making it possible to alter the $items?

Comments

atolborg’s picture

I found out that I can use hook_date_formatter_dates_alter() to change the dates.

atolborg’s picture

Status: Active » Closed (works as designed)