diff --git a/CHANGELOG.md b/CHANGELOG.md index d9d7d3c..5455aef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.3.2] - 2018-02-07 + +### Changed +- Fixed a bug in a function `add_field_location()` which is used by the functions `add_field_before()` and `add_field_after()`. + ## [1.3.1] - 2018-02-07 ### Changed diff --git a/plugin.php b/plugin.php index 38e8b8d..a6537e9 100644 --- a/plugin.php +++ b/plugin.php @@ -3,7 +3,7 @@ Plugin Name: ACF Codifier Plugin URI: https://github.com/devgeniem/acf-codifier Description: A helper class to make defining ACF field groups and fields easier in the code. -Version: 1.3.1 +Version: 1.3.2 Author: Miika Arponen / Geniem Oy Author URI: https://geniem.fi License: GPL-3.0 diff --git a/src/Field/Groupable.php b/src/Field/Groupable.php index 8444530..2af92a0 100644 --- a/src/Field/Groupable.php +++ b/src/Field/Groupable.php @@ -187,9 +187,10 @@ private function add_field_location( \Geniem\ACF\Field $field, $action, $target // Loop through the fields and populate the new array. foreach ( $this->{ $this->fields_var } as $key => $item ) { + // If this's the spot, do the right thing. if ( $action === 'before' && $key === $target ) { - $fields[ $target ] = $field; + $fields[ $field->get_name() ] = $field; } // Insert the original inhabitant. @@ -197,7 +198,7 @@ private function add_field_location( \Geniem\ACF\Field $field, $action, $target // And if this's the spot, do the right thing here. if ( $action === 'after' && $key === $target ) { - $fields[ $target ] = $field; + $fields[ $field->get_name() ] = $field; } }