Skip to content

Commit

Permalink
Release 1.2.13
Browse files Browse the repository at this point in the history
  • Loading branch information
EliasKau committed Dec 17, 2024
1 parent f1f0b91 commit ba465df
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 1.2.13: 2024-12-17

* Fix rendering function breaking if field was changed from multiple to single

### 1.2.12: 2024-12-16

* Properly setup field data when rendering
Expand Down
4 changes: 2 additions & 2 deletions acf-field-network-post-select.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Advanced Custom Fields: Network posts select field
* Plugin URI: https://github.com/digitoimistodude/acf-field-network-post-select
* Description: Adds a ACF field that allows selecting posts across the network sites.
* Version: 1.2.12
* Version: 1.2.13
* Author: Digitoimisto Dude Oy
* Author URI: https://www.dude.fi
* License: GPLv3 or later
Expand All @@ -21,7 +21,7 @@ class sippis_acf_plugin_network_post_select { // phpcs:ignore PEAR.NamingConvent

function __construct() { // phpcs:ignore PSR2.Classes.PropertyDeclaration.ScopeMissing, Squiz.Scope.MethodScope.Missing
$this->settings = array(
'version' => '1.2.12',
'version' => '1.2.13',
'url' => plugin_dir_url( __FILE__ ),
'path' => plugin_dir_path( __FILE__ ),
);
Expand Down
16 changes: 8 additions & 8 deletions class-sippis-acf-field-network-post-select.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ function render_field( $field ) { // phpcs:ignore

if ( isset( $field['multiple'] ) && 1 === $field['multiple'] ) {
// If we have previous single value, reset
if ( isset($field['value']['site_id'] ) ){
if ( isset($field['value']['site_id'] ) ) {
$field['value'] = [];
}

Expand All @@ -394,15 +394,15 @@ function render_field( $field ) { // phpcs:ignore
$field['value'] = $new_vals;
} else {
// If we have previous multiple, reset
if ( ! isset($field['value']['site_id'] ) ){
if ( ! isset($field['value']['site_id'] ) ) {
$field['value'] = [];
} else {
// try to get posts based on field value
$posts = $this->get_posts( $field['value'], $field );

// change field value format so it's in same format with AJAX query return
$field['value'] = $field['value']['site_id'] . '|' . $field['value']['post_id'];
}

// try to get posts based on field value
$posts = $this->get_posts( $field['value'], $field );

// change field value format so it's in same format with AJAX query return
$field['value'] = $field['value']['site_id'] . '|' . $field['value']['post_id'];
}

if ( $posts ) {
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"plugin"
],
"license": "GPLv3",
"version": "1.2.12"
"version": "1.2.13"
}

0 comments on commit ba465df

Please sign in to comment.