Skip to content

Commit 677553f

Browse files
committed
Refactor whitespace and formatting in multiple files for improved code readability. Cleaned up unnecessary blank lines and ensured consistent spacing in PHP files, enhancing overall maintainability.
1 parent 27b1f64 commit 677553f

3 files changed

Lines changed: 34 additions & 34 deletions

File tree

archive-template.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -813,34 +813,34 @@ class="bulk-edit-field-dropdown-search-input"
813813

814814
<!-- Scrollable options container -->
815815
<div class="bulk-edit-field-dropdown-options" role="listbox">
816-
<?php
816+
<?php
817817
// Build list of available fields (excluding already visible ones)
818818
$already_visible = [ 'assigned_to', 'subassigned', 'overall_status', 'coaches', 'share', 'requires_update', 'follow', 'comments' ];
819819
if ( $post_type == 'contacts' ) {
820820
$already_visible[] = 'reason_paused';
821821
}
822-
822+
823823
// Sort fields alphabetically by name
824824
uasort( $field_options, function ( $a, $b ) {
825825
return strnatcmp( $a['name'] ?? 'z', $b['name'] ?? 'z' );
826826
});
827-
827+
828828
$allowed_types = [ 'user_select', 'multi_select', 'key_select', 'date', 'datetime', 'location', 'location_meta', 'connection', 'tags', 'text', 'textarea', 'number' ];
829-
829+
830830
$available_fields_count = 0;
831831
foreach ( $field_options as $field_key => $field_values ):
832832
if ( in_array( $field_key, $already_visible ) ) {
833833
continue;
834834
}
835-
if ( empty( $field_values['hidden'] )
836-
&& isset( $field_values['type'] )
835+
if ( empty( $field_values['hidden'] )
836+
&& isset( $field_values['type'] )
837837
&& in_array( $field_values['type'], $allowed_types )
838838
&& $field_values['type'] != 'communication_channel' ) :
839839
$available_fields_count++;
840840
$has_icon = !empty( $field_values['icon'] ) || !empty( $field_values['font-icon'] );
841841
$option_classes = 'bulk-edit-field-search-option' . ( $has_icon ? '' : ' no-icon' );
842842
?>
843-
<div class="<?php echo esc_attr( $option_classes ); ?>"
843+
<div class="<?php echo esc_attr( $option_classes ); ?>"
844844
role="option"
845845
tabindex="-1"
846846
data-field-key="<?php echo esc_attr( $field_key ); ?>"
@@ -852,15 +852,15 @@ class="bulk-edit-field-dropdown-search-input"
852852
<?php endif;
853853
endforeach; ?>
854854
</div>
855-
855+
856856
<!-- Field count display -->
857857
<div class="bulk-edit-field-dropdown-footer">
858858
<span class="bulk-edit-field-count-text">
859-
<?php
860-
echo sprintf(
861-
esc_html( _n( '%d field available', '%d fields available', $available_fields_count, 'disciple_tools' ) ),
862-
$available_fields_count
863-
);
859+
<?php
860+
echo sprintf(
861+
esc_html( _n( '%d field available', '%d fields available', $available_fields_count, 'disciple_tools' ) ),
862+
esc_html( $available_fields_count )
863+
);
864864
?>
865865
</span>
866866
</div>

dt-core/utilities/dt-components.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static function shared_attributes( $field_key, $fields, $post, $params =
5555

5656
$hide_label = isset( $params['hide_label'] ) && $params['hide_label'] === true;
5757
$label_attr = $hide_label ? '' : 'label="' . esc_attr( $fields[$field_key]['name'] ) . '"';
58-
58+
5959
$shared_attributes = '
6060
id="' . esc_attr( $display_field_id ) . '"
6161
name="' . esc_attr( $field_key ) . '"

dt-posts/dt-posts-endpoints.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -661,38 +661,38 @@ public function split_by( WP_REST_Request $request ){
661661
/**
662662
* Render field HTML for display
663663
* Generic endpoint that can be used for bulk edit, forms, or other field rendering needs
664-
*
664+
*
665665
* @param WP_REST_Request $request
666666
* @return array|WP_Error
667667
*/
668668
public function render_field_html( WP_REST_Request $request ){
669669
$url_params = $request->get_url_params();
670670
$get_params = $request->get_query_params();
671-
671+
672672
$post_type = $url_params['post_type'];
673673
$field_key = $get_params['field_key'] ?? '';
674674
$field_id_prefix = $get_params['field_id_prefix'] ?? '';
675-
675+
676676
if ( empty( $field_key ) ) {
677677
return new WP_Error( 'missing_field_key', 'Field key is required', [ 'status' => 400 ] );
678678
}
679-
679+
680680
// Check if user has access to this post type
681681
if ( !current_user_can( 'access_' . $post_type ) ) {
682682
return new WP_Error( 'permission_denied', 'You do not have permission to access this post type', [ 'status' => 403 ] );
683683
}
684-
684+
685685
// Get field settings
686686
$field_settings = DT_Posts::get_post_field_settings( $post_type, false );
687-
687+
688688
if ( !isset( $field_settings[$field_key] ) ) {
689689
return new WP_Error( 'field_not_found', 'Field not found', [ 'status' => 404 ] );
690690
}
691-
691+
692692
// Prepare field options for rendering
693693
$field_options = $field_settings;
694694
$field_options[$field_key]['custom_display'] = false;
695-
695+
696696
// Set field params - can be customized via query params in the future
697697
$field_params = [
698698
'connection' => [
@@ -703,7 +703,7 @@ public function render_field_html( WP_REST_Request $request ){
703703
],
704704
'hide_label' => true, // Hide label since we show our own header
705705
];
706-
706+
707707
// Capture rendered field HTML
708708
ob_start();
709709
$error_occurred = false;
@@ -714,33 +714,33 @@ public function render_field_html( WP_REST_Request $request ){
714714
error_log( 'Error rendering field ' . $field_key . ': ' . $e->getMessage() );
715715
}
716716
$rendered_field_html = ob_get_clean();
717-
717+
718718
// Check for PHP errors in output
719719
if ( $error_occurred || empty( trim( $rendered_field_html ) ) ) {
720-
$error_message = sprintf(
721-
'Field "%s" (type: %s) could not be rendered.',
720+
$error_message = sprintf(
721+
'Field "%s" (type: %s) could not be rendered.',
722722
$field_key,
723723
$field_settings[$field_key]['type'] ?? 'unknown'
724724
);
725-
725+
726726
// Add more specific error details if available
727727
if ( $error_occurred ) {
728728
$error_message .= ' An exception occurred during rendering.';
729729
} else {
730730
$error_message .= ' No HTML was generated. This may be due to field type restrictions, missing dependencies, or field configuration issues.';
731731
}
732-
733-
return new WP_Error(
734-
'field_not_rendered',
735-
$error_message,
736-
[
732+
733+
return new WP_Error(
734+
'field_not_rendered',
735+
$error_message,
736+
[
737737
'status' => 500,
738738
'field_key' => $field_key,
739739
'field_type' => $field_settings[$field_key]['type'] ?? ''
740-
]
740+
]
741741
);
742742
}
743-
743+
744744
return [
745745
'html' => $rendered_field_html,
746746
'field_key' => $field_key,

0 commit comments

Comments
 (0)