Class Drupal\datetime\Hook\DatetimeViewsHooks - Source Code

Primary tabs

API docs: https://api.drupal.org/api/drupal/core!modules!datetime!src!Hook!DatetimeViewsHooks.php/11.3.x

GitLab: https://git.drupalcode.org/project/drupal/-/blob/11.3.x/core/modules/datetime/src/Hook/DatetimeViewsHooks.php

Location: /core/modules/datetime/src/Hook/DatetimeViewsHooks.php

    
        
namespace Drupal\datetime\Hook;

use Drupal\datetime\DateTimeViewsHelper;
use Drupal\field\FieldStorageConfigInterface;
use Drupal\Core\Hook\Attribute\Hook;

/**
 * Hook implementations for datetime.
 */
class DatetimeViewsHooks {

  public function __construct(
    protected readonly DateTimeViewsHelper $dateTimeViewsHelper,
  ) {}

  /**
   * Implements hook_field_views_data().
   */
  #[Hook('field_views_data')]
  public function fieldViewsData(FieldStorageConfigInterface $field_storage): array {
    return $this->dateTimeViewsHelper->buildViewsData($field_storage, [], $field_storage->getMainPropertyName());
  }

}