$field): array $get_overrides getter of the field args to merge */ public static function override_field_settings( string $field_name, callable $get_overrides ): void { $merge_overrides = function ( array $field ) use ( $get_overrides ): array { $overrides = $get_overrides( $field ); return array_merge( $field, $overrides ); }; $hook_name = sprintf( 'acf/load_field/name=%s', $field_name ); Actor_Base::add_filter( $hook_name, $merge_overrides ); } /** * @param class-string $group_class * @param array $field): array> $choices_callbacks field constant => choices getter */ public static function bind_field_choices( string $group_class, array $choices_callbacks ): void { foreach ( $choices_callbacks as $field_constant => $get_choices ) { $field_name = $group_class::getAcfFieldName( $field_constant ); $get_overrides = fn( array $field ) => array( 'choices' => $get_choices( $field ) ); self::override_field_settings( $field_name, $get_overrides ); } } }