Skip to content

Commit b2c2fe5

Browse files
committed
- handle resolving date range on blocks
1 parent 813dd8e commit b2c2fe5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/ThirdParty/AcfExtended/FieldType/AcfeDateRangePicker.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ public static function register_field_type(): void {
1818
$value = $field_config->resolve_field( $root, $args, $context, $info );
1919
$start_date = $value['start'] ?? null;
2020
$end_date = $value['end'] ?? null;
21+
$acf_field = $field_config->get_acf_field();
22+
23+
// handle resolving from a block
24+
if ( empty( $start_date ) ) {
25+
$start_date = $field_config->resolve_field( $root, $args, $context, $info, [ 'name' => $acf_field['name'] . '_start' ] );
26+
}
27+
28+
// handle resolving from a block
29+
if ( empty( $end_date ) ) {
30+
$end_date = $field_config->resolve_field( $root, $args, $context, $info, [ 'name' => $acf_field['name'] . '_end' ] );
31+
}
2132

2233
if ( ! empty( $start_date ) ) {
2334
$_start_date = \DateTime::createFromFormat( 'Ymd|', $start_date );

0 commit comments

Comments
 (0)