Skip to content

Commit 305235c

Browse files
authored
Pods 3.3.3 (#7442)
2 parents 1a08144 + de5d785 commit 305235c

File tree

19 files changed

+237
-117
lines changed

19 files changed

+237
-117
lines changed

changelog.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ Found a bug? Have a great feature idea? Get on GitHub and tell us about it and w
22

33
Our GitHub has the full list of all prior releases of Pods: https://github.com/pods-framework/pods/releases
44

5+
= 3.3.3 - September 4th, 2025 =
6+
7+
* Tweak: Support referencing ID for `PodsMeta::groups_get()`. (@sc0ttkclark)
8+
* Tweak: Update edit capability used for settings Pods so it can be displayed on the edit pod screen correctly. (@sc0ttkclark)
9+
* Fixed: Resolve issues with TinyMCE and Quill editors not loading when used as repeatable fields or conditional logic. #7448 #7438 #7430 (@multisme, @altermulti, @sc0ttkclark, @ztackett11)
10+
* Fixed: Resolve PHP fatal errors for undefined constant `\Pods\Whatsit\Store::PLACEHOLDER` in some edge case circumstances. #7445 (@sc0ttkclark, @Hue-SPetrovic)
11+
* Fixed: Resolve PHP 8.4 deprecation warnings with DI52 usage. #7448 (@sc0ttkclark, @doehry)
12+
* Fixed: Resolve warnings when using `--args` with WP-CLI commands. #7452 (@sc0ttkclark, @KhaledSakr)
13+
* Fixed: Resolve handling of decimals when auto-formatting to prevent removing zero number values and expand decimal handling for more cases. Improve logic matching (except dashes) for PHP vs JS. (@sc0ttkclark)
14+
* Fixed: Resolve field assigment issue in `pods_config_merge_data()` to reference the correct field. (@sc0ttkclark)
15+
516
= 3.3.2 - July 8th, 2025 =
617

718
* Tweak: Updated Swagger docs for Pods REST API endpoints. (@sc0ttkclark)

classes/Pods.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4187,7 +4187,7 @@ public function view( $view_fields = null ) {
41874187
];
41884188
}
41894189

4190-
$field = pods_config_merge_data( $defaults, $fields );
4190+
$field = pods_config_merge_data( $defaults, $field );
41914191

41924192
$field['name'] = trim( $field['name'] );
41934193

classes/PodsInit.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1996,8 +1996,8 @@ public static function object_label_fix( array $args, string $type, ?string $nam
19961996
$args['labels'] = [];
19971997
}
19981998

1999-
$is_placeholder_label = Store::PLACEHOLDER === pods_v( 'label', $args );
2000-
$is_placeholder_description = Store::PLACEHOLDER === pods_v( 'description', $args );
1999+
$is_placeholder_label = defined( Store::class . '::PLACEHOLDER' ) && Store::PLACEHOLDER === pods_v( 'label', $args );
2000+
$is_placeholder_description = defined( Store::class . '::PLACEHOLDER' ) && Store::PLACEHOLDER === pods_v( 'description', $args );
20012001

20022002
if ( $is_placeholder_label || $is_placeholder_description ) {
20032003
$default_object_labels = Store::get_default_object_labels();

classes/PodsMeta.php

Lines changed: 52 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -891,8 +891,8 @@ public function object_get( $type, $name ) {
891891
*
892892
* @return array List of groups and their fields.
893893
*/
894-
public function groups_get( $type, $name, $default_fields = null, $full_objects = false ) {
895-
$cache_key = $type . '/' . $name;
894+
public function groups_get( $type, $name, $default_fields = null, $full_objects = false, $id = null ) {
895+
$cache_key = $type . '/' . $name . '/' . $id;
896896

897897
if ( $full_objects ) {
898898
$cache_key .= '/full';
@@ -911,7 +911,7 @@ public function groups_get( $type, $name, $default_fields = null, $full_objects
911911
$type = 'taxonomy';
912912
}
913913

914-
do_action( 'pods_meta_groups', $type, $name );
914+
do_action( 'pods_meta_groups', $type, $name, $id );
915915

916916
$pod = [];
917917
$fields = [];
@@ -978,13 +978,14 @@ public function groups_get( $type, $name, $default_fields = null, $full_objects
978978
*
979979
* @since unknown
980980
*
981-
* @param string $title The title to use, default is 'More Fields'.
982-
* @param obj|Pod $pod Current Pods Object.
983-
* @param array $fields Array of fields that will go in the metabox.
984-
* @param string $type The type of Pod.
985-
* @param string $name Name of the Pod.
981+
* @param string $title The title to use, default is 'More Fields'.
982+
* @param obj|Pod $pod Current Pods Object.
983+
* @param array $fields Array of fields that will go in the metabox.
984+
* @param string $type The type of Pod.
985+
* @param string $name Name of the Pod.
986+
* @param int|string|null $id The item ID.
986987
*/
987-
$title = apply_filters( 'pods_meta_default_box_title', __( 'More Fields', 'pods' ), $pod, $fields, $type, $name );
988+
$title = apply_filters( 'pods_meta_default_box_title', __( 'More Fields', 'pods' ), $pod, $fields, $type, $name, $id );
988989

989990
$groups = [];
990991

@@ -1052,11 +1053,12 @@ public function groups_get( $type, $name, $default_fields = null, $full_objects
10521053
*
10531054
* @since 2.6.6
10541055
*
1055-
* @param array $groups Array of groups
1056-
* @param string $type The type of Pod
1057-
* @param string $name Name of the Pod
1056+
* @param array $groups Array of groups
1057+
* @param string $type The type of Pod
1058+
* @param string $name Name of the Pod
1059+
* @param int|string|null $id The item ID
10581060
*/
1059-
$groups = apply_filters( 'pods_meta_groups_get', $groups, $type, $name );
1061+
$groups = apply_filters( 'pods_meta_groups_get', $groups, $type, $name, $id );
10601062

10611063
pods_static_cache_set( $cache_key, $groups, __CLASS__ . '/groups_get' );
10621064

@@ -1117,11 +1119,14 @@ public function meta_post_add( $post_type, $post = null ) {
11171119
return;
11181120
}
11191121

1122+
$post_id = null;
1123+
11201124
if ( is_object( $post ) ) {
11211125
$post_type = $post->post_type;
1126+
$post_id = $post->ID;
11221127
}
11231128

1124-
$groups = $this->groups_get( 'post_type', $post_type );
1129+
$groups = $this->groups_get( 'post_type', $post_type, null, false, $post_id );
11251130
$pods_field_found = false;
11261131

11271132
foreach ( $groups as $group ) {
@@ -1488,7 +1493,7 @@ public function save_post( $post_id, $post, $update = null ) {
14881493
return;
14891494
}
14901495

1491-
$groups = $this->groups_get( 'post_type', $post->post_type );
1496+
$groups = $this->groups_get( 'post_type', $post->post_type, null, false, $post_id );
14921497

14931498
$id = $post_id;
14941499
$pod = $this->maybe_set_up_pod( $post->post_type, $id, 'post_type' );
@@ -1612,7 +1617,13 @@ public function save_post_track_changed_fields( $data, $postarr ) {
16121617
*/
16131618
public function meta_media( $form_fields, $post ) {
16141619

1615-
$groups = $this->groups_get( 'media', 'media' );
1620+
$post_id = null;
1621+
1622+
if ( is_object( $post ) ) {
1623+
$post_id = $post->ID;
1624+
}
1625+
1626+
$groups = $this->groups_get( 'media', 'media', null, false, $post_id );
16161627

16171628
if ( empty( $groups ) || 'attachment' === pods_v( 'typenow', 'global' ) ) {
16181629
return $form_fields;
@@ -1712,12 +1723,6 @@ public function meta_media( $form_fields, $post ) {
17121723
*/
17131724
public function save_media( $post, $attachment ) {
17141725

1715-
$groups = $this->groups_get( 'media', 'media' );
1716-
1717-
if ( empty( $groups ) ) {
1718-
return $post;
1719-
}
1720-
17211726
$post_id = $attachment;
17221727

17231728
if ( empty( $_POST ) || ! wp_verify_nonce( pods_v( 'pods_meta', 'post' ), 'pods_meta_media' ) ) {
@@ -1732,6 +1737,12 @@ public function save_media( $post, $attachment ) {
17321737
return $post;
17331738
}
17341739

1740+
$groups = $this->groups_get( 'media', 'media', null, false, $post_id );
1741+
1742+
if ( empty( $groups ) ) {
1743+
return $post;
1744+
}
1745+
17351746
$data = array();
17361747

17371748
$id = $post_id;
@@ -1864,14 +1875,14 @@ public function meta_taxonomy( $tag, $taxonomy = null ) {
18641875
$taxonomy_name = $tag;
18651876
}
18661877

1867-
$groups = $this->groups_get( 'taxonomy', $taxonomy_name );
1868-
18691878
$id = null;
18701879

18711880
if ( is_object( $tag ) ) {
18721881
$id = $tag->term_id;
18731882
}
18741883

1884+
$groups = $this->groups_get( 'taxonomy', $taxonomy_name, null, false, $id );
1885+
18751886
$pod = null;
18761887

18771888
static $nonced_types = [];
@@ -1963,7 +1974,7 @@ public function save_taxonomy( $term_id, $term_taxonomy_id, $taxonomy ) {
19631974
return $term_id;
19641975
}
19651976

1966-
$groups = $this->groups_get( 'taxonomy', $taxonomy );
1977+
$groups = $this->groups_get( 'taxonomy', $taxonomy, null, false, $term_id );
19671978

19681979
if ( empty( $groups ) ) {
19691980
return $term_id;
@@ -2112,15 +2123,21 @@ public function meta_user( $user_id ) {
21122123

21132124
do_action( 'pods_meta_meta_user', $user_id );
21142125

2115-
$groups = $this->groups_get( 'user', 'user' );
2116-
21172126
if ( is_object( $user_id ) ) {
21182127
$user = $user_id;
21192128
$user_id = $user_id->ID;
21202129
} else {
21212130
$user = get_userdata( $user_id );
2131+
2132+
if ( ! $user ) {
2133+
return;
2134+
}
2135+
2136+
$user_id = $user->ID;
21222137
}
21232138

2139+
$groups = $this->groups_get( 'user', 'user', null, false, $user_id );
2140+
21242141
$id = $user_id;
21252142
$pod = null;
21262143

@@ -2246,7 +2263,7 @@ public function save_user( $user_id, $old_user_data = null ) {
22462263
$user_id = $user_id->ID;
22472264
}
22482265

2249-
$groups = $this->groups_get( 'user', 'user' );
2266+
$groups = $this->groups_get( 'user', 'user', null, false, $user_id );
22502267

22512268
$id = $user_id;
22522269
$pod = $this->maybe_set_up_pod( 'user', $id, 'user' );
@@ -2675,16 +2692,18 @@ public function validate_comment( $approved, $commentdata ) {
26752692
*/
26762693
public function save_comment( $comment_id ) {
26772694

2678-
$groups = $this->groups_get( 'comment', 'comment' );
2679-
2680-
if ( empty( $groups ) ) {
2681-
return $comment_id;
2682-
} elseif ( empty( $_POST ) ) {
2695+
if ( empty( $_POST ) ) {
26832696
return $comment_id;
26842697
} elseif ( ! wp_verify_nonce( pods_v( 'pods_meta', 'post' ), 'pods_meta_comment' ) ) {
26852698
return $comment_id;
26862699
}
26872700

2701+
$groups = $this->groups_get( 'comment', 'comment', null, false, $comment_id );
2702+
2703+
if ( empty( $groups ) ) {
2704+
return $comment_id;
2705+
}
2706+
26882707
$data = array();
26892708

26902709
$id = $comment_id;

classes/fields/currency.php

Lines changed: 12 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,19 @@ public function options() {
120120
'help' => __( 'Set to a positive number to enable decimals. The upper limit in the database for this field is 30 decimals.', 'pods' ),
121121
),
122122
static::$type . '_decimal_handling' => array(
123-
'label' => __( 'Decimal handling when zero', 'pods' ),
124-
'default' => 'none',
125-
'type' => 'pick',
126-
'data' => array(
127-
'none' => __( 'Default', 'pods' ),
128-
'remove' => __( 'Remove decimals', 'pods' ),
129-
'dash' => __( 'Convert to dash', 'pods' ) . ' (-)',
123+
'label' => __( 'Decimal handling for trailing zero decimals', 'pods' ),
124+
'description' => __( '', 'pods' ),
125+
'default' => 'none',
126+
'type' => 'pick',
127+
'data' => array(
128+
'none' => __( 'Default (Examples: "$1.00", "$0.00")', 'pods' ),
129+
'remove' => __( 'Remove decimals (Examples: "$1", "$0")', 'pods' ),
130+
'remove_only_zero' => __( 'Remove decimals only when number is zero (Examples: "$1.00", "$0")', 'pods' ),
131+
'dash' => __( 'Convert to dash (Examples: "$1.-", "$0.-")', 'pods' ),
132+
'dash_only_zero' => __( 'Convert to dash only when number is zero (Examples: "$1.00", "$0.-")', 'pods' ),
133+
'dash_whole_zero' => __( 'Convert to the whole value to dash when number is zero (Examples: "$1.00", "$-")', 'pods' ),
130134
),
131-
'pick_format_single' => 'dropdown',
135+
'pick_format_single' => 'dropdown',
132136
'pick_show_select_text' => 0,
133137
),
134138
static::$type . '_step' => array(
@@ -313,38 +317,6 @@ public function pre_save( $value, $id = null, $name = null, $options = null, $fi
313317

314318
}
315319

316-
/**
317-
* {@inheritdoc}
318-
*/
319-
public function format( $value = null, $name = null, $options = null, $pod = null, $id = null ) {
320-
321-
$value = parent::format( $value, $name, $options, $pod, $id );
322-
if ( null === $value ) {
323-
return $value;
324-
}
325-
326-
// Additional output handling for decimals
327-
$decimal_handling = pods_v( static::$type . '_decimal_handling', $options, 'none' );
328-
if ( 'none' !== $decimal_handling ) {
329-
$format_args = $this->get_number_format_args( $options );
330-
$dot = $format_args['dot'];
331-
$value_parts = explode( $dot, $value );
332-
// Make sure decimals are empty.
333-
if ( isset( $value_parts[1] ) && ! (int) $value_parts[1] ) {
334-
if ( 'remove' === $decimal_handling ) {
335-
array_pop( $value_parts );
336-
} elseif ( 'dash' === $decimal_handling ) {
337-
array_pop( $value_parts );
338-
$value_parts[] = '-';
339-
}
340-
$value = implode( $dot, $value_parts );
341-
}
342-
}
343-
344-
return $value;
345-
346-
}
347-
348320
/**
349321
* Get the currencies and place them in the local property
350322
*

0 commit comments

Comments
 (0)