diff --git a/CHANGELOG.md b/CHANGELOG.md index e6a298b..fb6be08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.7.1] - 2026-02-03 + +### Added + +- CF7 Admin Tag Generator buttons: + - Tag generator buttons appear in CF7 form editor for all WP BnB custom tags + - BnB Building select with first option label configuration + - BnB Room select with building field linking and price display options + - BnB Check-in date with min/max advance booking days + - BnB Check-out date with check-in field linking and min/max nights + - BnB Guests count with room field linking and min/max/default values + - All generators support id and class attribute configuration + ## [0.7.0] - 2026-02-03 ### Added diff --git a/CLAUDE.md b/CLAUDE.md index 6e9560e..9860b8a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -40,7 +40,7 @@ This project is proudly **"vibe-coded"** using Claude.AI - the entire codebase w ### Known Bugs -No known bugs at this time. +(none) ## Technical Stack diff --git a/src/Integration/CF7.php b/src/Integration/CF7.php index c245317..429d7db 100644 --- a/src/Integration/CF7.php +++ b/src/Integration/CF7.php @@ -46,6 +46,9 @@ final class CF7 { // Register custom form tags. add_action( 'wpcf7_init', array( self::class, 'register_form_tags' ) ); + // Register tag generators for admin. + add_action( 'wpcf7_admin_init', array( self::class, 'register_tag_generators' ), 60 ); + // Register validation filters. add_filter( 'wpcf7_validate_bnb_room_select', array( self::class, 'validate_room_select' ), 10, 2 ); add_filter( 'wpcf7_validate_bnb_room_select*', array( self::class, 'validate_room_select' ), 10, 2 ); @@ -119,6 +122,570 @@ final class CF7 { ); } + /** + * Register tag generators for CF7 admin. + * + * @return void + */ + public static function register_tag_generators(): void { + if ( ! class_exists( 'WPCF7_TagGenerator' ) ) { + return; + } + + $tag_generator = \WPCF7_TagGenerator::get_instance(); + + // Building select tag generator. + $tag_generator->add( + 'bnb_building_select', + __( 'BnB building', 'wp-bnb' ), + array( self::class, 'tag_generator_building_select' ), + array( 'version' => '2' ) + ); + + // Room select tag generator. + $tag_generator->add( + 'bnb_room_select', + __( 'BnB room', 'wp-bnb' ), + array( self::class, 'tag_generator_room_select' ), + array( 'version' => '2' ) + ); + + // Check-in date tag generator. + $tag_generator->add( + 'bnb_date_checkin', + __( 'BnB check-in', 'wp-bnb' ), + array( self::class, 'tag_generator_date_checkin' ), + array( 'version' => '2' ) + ); + + // Check-out date tag generator. + $tag_generator->add( + 'bnb_date_checkout', + __( 'BnB check-out', 'wp-bnb' ), + array( self::class, 'tag_generator_date_checkout' ), + array( 'version' => '2' ) + ); + + // Guests count tag generator. + $tag_generator->add( + 'bnb_guests', + __( 'BnB guests', 'wp-bnb' ), + array( self::class, 'tag_generator_guests' ), + array( 'version' => '2' ) + ); + } + + /** + * Tag generator callback for building select. + * + * @param \WPCF7_ContactForm $contact_form Contact form object. + * @param array $options Tag generator options. + * @return void + */ + public static function tag_generator_building_select( $contact_form, $options = array() ): void { + $field_id = $options['content'] ?? 'wpcf7-tg-pane-bnb_building_select'; + $field_type = 'bnb_building_select'; + ?> +
+

+

+
+ +
+
+ + + + +
+ +
+ + + + +
+ +
+ + + + +
+ +
+ + + + +
+ +
+ + + + +
+
+ + + +
+

+

+
+ +
+
+ + + + +
+ +
+ + + + +
+ +
+ + + + +

+ +

+
+ +
+ + + + +
+ +
+ + + + +
+ +
+ + + + +
+
+ + + +
+

+

+
+ +
+
+ + + + +
+ +
+ + + + +
+ +
+ + + + +

+ +

+
+ +
+ + + + +

+ +

+
+ +
+ + + + +
+ +
+ + + + +
+
+ + + +
+

+

+
+ +
+
+ + + + +
+ +
+ + + + +
+ +
+ + + + +

+ +

+
+ +
+ + + + +
+ +
+ + + + +
+ +
+ + + + +
+ +
+ + + + +
+
+ + + +
+

+

+
+ +
+
+ + + + +
+ +
+ + + + +
+ +
+ + + + +

+ +

+
+ +
+ + + + +
+ +
+ + + + +
+ +
+ + + + +
+ +
+ + + + +
+ +
+ + + + +
+
+ + +