Skip to content

Commit 429a140

Browse files
committed
Update prepare_data() to better use the passed field
1 parent 054c0ba commit 429a140

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

php/context/class-fieldmanager-context.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,19 @@ protected function is_valid_nonce() {
5151
*
5252
* @param mixed $old_value Optional. The previous value.
5353
* @param mixed $new_value Optional. The new value for the field.
54-
* @param object $fm Optional. The Fieldmanager field to prepare.
54+
* @param object $fm Optional. The Fieldmanager_Field to prepare.
5555
* @return mixed The filtered and sanitized value, safe to save.
5656
*/
5757
protected function prepare_data( $old_value = null, $new_value = null, $fm = null ) {
5858
if ( null === $fm ) {
5959
$fm = $this->fm;
6060
}
6161
if ( null === $new_value ) {
62-
$new_value = isset( $_POST[ $this->fm->name ] ) ? $_POST[ $this->fm->name ] : '';
62+
$new_value = isset( $_POST[ $fm->name ] ) ? $_POST[ $fm->name ] : '';
6363
}
64-
$new_value = apply_filters( "fm_context_before_presave_data", $new_value, $old_value, $this );
64+
$new_value = apply_filters( "fm_context_before_presave_data", $new_value, $old_value, $this, $fm );
6565
$data = $fm->presave_all( $new_value, $old_value );
66-
return apply_filters( "fm_context_after_presave_data", $data, $old_value, $this );
66+
return apply_filters( "fm_context_after_presave_data", $data, $old_value, $this, $fm );
6767
}
6868

6969

0 commit comments

Comments
 (0)