| @@ -55,9 +55,9 @@ | ||
| 55 | 55 | <?php |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public function save( $post_id ) { |
| 59 | - $data = isset( $_POST[ $this->id ] ) ? wp_unslash( $_POST[ $this->id ] ) : array(); | |
| 59 | + $data = LP_Request::get_param( $this->id, $this->default ?? [], 'html' ); | |
| 60 | 60 | $output = array(); |
| 61 | 61 | |
| 62 | 62 | if ( ! empty( $data ) && is_array( $data ) ) { |
| 63 | 63 | foreach ( $data as $key => $val ) { |
| @@ -74,8 +74,10 @@ | ||
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | update_post_meta( $post_id, $this->id, $output ); |
| 78 | + | |
| 79 | + return $output; | |
| 78 | 80 | } |
| 79 | 81 | |
| 80 | 82 | public function repeater_html( $thepostid, $repeater, $is_attr = false, $key = 'lp_metabox_repeater_key' ) { |
| 81 | 83 | ?> |
| @@ -94,9 +96,9 @@ | ||
| 94 | 96 | <?php |
| 95 | 97 | if ( isset( $this->extra['fields'] ) ) { |
| 96 | 98 | foreach ( $this->extra['fields'] as $field_key => $field ) { |
| 97 | 99 | $field->id = $this->id . '[' . $key . '][' . $field_key . ']'; |
| 98 | - $field->extra['value'] = $is_attr ? '' : $repeater[ $field_key ]; | |
| 100 | + $field->extra['value'] = $is_attr ? '' : ( $repeater[ $field_key ] ?? '' ); | |
| 99 | 101 | learn_press_echo_vuejs_write_on_php( $field->output( $thepostid ) ); |
| 100 | 102 | } |
| 101 | 103 | } |
| 102 | 104 | ?> |