Patch: Caption title above order details + customizing options of output added
-
Thanks @brandonxlf for the great work on the plugin!
I have added some code to add another setting for making the title above the order confirmation (webpage + mail) configurable via admin ui + added the call to WordPress filters to make output for order summary page and order mail programmatically configurable.
--- src/includes/class-settings.org.php 2024-07-05 10:16:52.648035283 +0200
+++ src/includes/class-settings.php 2024-07-05 10:39:09.851014367 +0200
@@ -419,6 +419,15 @@
}
/**
+ * Show setting to get title for tables in order details.
+ */
+ public static function header_title_setting() {
+ $title = get_option('cffu_header_title', 'Fields and files');
+
+ echo '<input type="text" name="cffu_header_title" value="'.$title.'">';
+ }
+
+ /**
* Show setting to hide default WooCommerce order notes.
*/
public static function hide_notes_setting() {
@@ -441,6 +450,11 @@
register_setting(
'cffu_settings',
+ 'cffu_header_title'
+ );
+
+ register_setting(
+ 'cffu_settings',
'cffu_hide_notes'
);
@@ -466,6 +480,14 @@
'fields-and-file-upload-settings',
'cffu_config_settings'
);
+
+ add_settings_field(
+ 'cffu_header_title_setting',
+ 'Caption title placed above table of fields in order confirmation',
+ [ __CLASS__, 'header_title_setting' ],
+ 'fields-and-file-upload-settings',
+ 'cffu_config_settings'
+ );
add_settings_field(
'cffu_hide_note_setting',
--- src/includes/class-display.org.php 2024-07-05 10:17:40.130720742 +0200
+++ src/includes/class-display.php 2024-07-05 10:58:03.315635800 +0200
@@ -278,9 +278,19 @@
return;
}
- echo '<h2 class="woocommerce-column__title">Fields and files</h2>';
+ $title = get_option('cffu_header_title', 'Fields and files');
+
+ ob_start();
+ echo '<section class="woocommerce-customer-details">';
+ echo '<h2 class="woocommerce-column__title">'.$title.'</h2>';
self::show_fields_for_order( $order );
+
+ echo '</section>';
+ $html = ob_get_contents();
+ ob_end_clean();
+
+ echo apply_filters('cffu_show_order', $html);
}
/**
@@ -315,8 +325,15 @@
return;
}
- echo '<h2>Fields and files</h2>';
+ $title = get_option('cffu_header_title', 'Fields and files');
+ ob_start();
+ echo '<h2>'.$title.'</h2>';
self::show_fields_for_order( $order, true );
+ $html = ob_get_contents();
+ ob_end_clean();
+
+ echo apply_filters('cffu_email_table', $html);
+
}
}Cheers,
Matthieu
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.