Skip to main content

GravityKit\GravityMigrate\EntriesDateRangePicker

Puts Query Filters' date range picker on the settings page for the wizard to mount.

Query Filters is vendored as a composer library rather than depended on as a plugin, so nothing here requires another plugin to be active. Strauss prefixes the PHP and only the PHP: the JavaScript bundle registers under one un-prefixed handle shared by every GravityKit product on the site, and the newest vendored copy wins it.

Since: %ver%

Source: src/EntriesDateRangePicker.php:25

Details​

  • Kind: class
  • Namespace: GravityKit\GravityMigrate

Methods​

MethodDescription
enqueue()Registers and enqueues the picker bundle for the current request.
add_long_range_presets()Adds the wider ranges an entries export is asked for.
meta()The configuration handed to Query Filters.
segment_order()The order Query Filters should show the day, month and year segments in.

Method Reference​

enqueue()​

public static function enqueue(): void

Registers and enqueues the picker bundle for the current request.

Returns​

  • void

Since: %ver%

Source: src/EntriesDateRangePicker.php:58

add_long_range_presets()​

public static function add_long_range_presets( array $presets, DateTimeInterface $now ): array

Adds the wider ranges an entries export is asked for.

The picker's own list stops at last month, which is shorter than the span most exports are cut to.

Parameters​

NameTypeDefaultDescription
$presetsarrayThe presets the picker will show.
$nowDateTimeInterfaceThe moment every range is measured back from.

Returns​

  • array — The presets, with the longer ranges appended.

Since: %ver%

Source: src/EntriesDateRangePicker.php:134

meta()​

public static function meta( string $today, string $wp_date_format ): array

The configuration handed to Query Filters.

Parameters​

NameTypeDefaultDescription
$todaystringToday, in Y-m-d, in the site's timezone.
$wp_date_formatstringThe site's date format option, e.g. 'F j, Y'.

Returns​

  • array — The meta array for QueryFilters::enqueue_date_range_picker().

Since: %ver%

Source: src/EntriesDateRangePicker.php:177

segment_order()​

public static function segment_order( string $wp_date_format ): string

The order Query Filters should show the day, month and year segments in.

Only the order is read, never the separator: a WordPress date format carries literal text that a segmented input has no equivalent for.

Parameters​

NameTypeDefaultDescription
$wp_date_formatstringThe site's date format option.

Returns​

  • string — One of mdy, dmy, ymd.

Since: %ver%

Source: src/EntriesDateRangePicker.php:199