Skip to content

Commit

Permalink
Patch that fixes back-compatibility issue when adding fields array to…
Browse files Browse the repository at this point in the history
… the metabox registration. Fixes CMB2#472.
  • Loading branch information
jtsternberg committed Oct 1, 2015
1 parent 70d2dbc commit a04e06e
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 17 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.

## [Unreleased][unreleased]

## 2.1.2 - 2015-10-01

### Bug Fixes

* Fixes back-compatibility issue when adding fields array to the metabox registration. ([#472](https://github.com/WebDevStudios/CMB2/pull/472))

## 2.1.1 - 2015-09-30

### Enhancements
Expand Down
10 changes: 8 additions & 2 deletions includes/CMB2.php
Original file line number Diff line number Diff line change
Expand Up @@ -838,12 +838,18 @@ public function get_field_args( $field_id, $field_args, $sub_field_id, $field_gr
protected function add_fields( $fields, $parent_field_id = null ) {
foreach ( $fields as $field ) {

$sub_fields = false;
if ( array_key_exists( 'fields', $field ) ) {
$sub_fields = $field['fields'];
unset( $field['fields'] );
}

$field_id = $parent_field_id
? $this->add_group_field( $parent_field_id, $field )
: $this->add_field( $field );

if ( array_key_exists( 'fields', $field ) ) {
$this->add_fields( $field['fields'], $field_id );
if ( $sub_fields ) {
$this->add_fields( $sub_fields, $field_id );
}
}
}
Expand Down
20 changes: 10 additions & 10 deletions init.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Bill Erickson (@billerickson / billerickson.net)
* Andrew Norcross (@norcross / andrewnorcross.com)
*
* Version: 2.1.1
* Version: 2.1.2
*
* Text Domain: cmb2
* Domain Path: languages
Expand Down Expand Up @@ -48,7 +48,7 @@
or things might explode!
*************************************************************************/

if ( ! class_exists( 'CMB2_Bootstrap_211', false ) ) {
if ( ! class_exists( 'CMB2_Bootstrap_212', false ) ) {

/**
* Handles checking for and loading the newest version of CMB2
Expand All @@ -61,14 +61,14 @@
* @license GPL-2.0+
* @link http://webdevstudios.com
*/
class CMB2_Bootstrap_211 {
class CMB2_Bootstrap_212 {

/**
* Current version number
* @var string
* @since 1.0.0
*/
const VERSION = '2.1.1';
const VERSION = '2.1.2';

/**
* Current version hook priority.
Expand All @@ -77,20 +77,20 @@ class CMB2_Bootstrap_211 {
* @var int
* @since 2.0.0
*/
const PRIORITY = 9988;
const PRIORITY = 9987;

/**
* Single instance of the CMB2_Bootstrap_211 object
* Single instance of the CMB2_Bootstrap_212 object
*
* @var CMB2_Bootstrap_211
* @var CMB2_Bootstrap_212
*/
public static $single_instance = null;

/**
* Creates/returns the single instance CMB2_Bootstrap_211 object
* Creates/returns the single instance CMB2_Bootstrap_212 object
*
* @since 2.0.0
* @return CMB2_Bootstrap_211 Single instance object
* @return CMB2_Bootstrap_212 Single instance object
*/
public static function initiate() {
if ( null === self::$single_instance ) {
Expand Down Expand Up @@ -177,6 +177,6 @@ public function l10ni18n() {
}

// Make it so...
CMB2_Bootstrap_211::initiate();
CMB2_Bootstrap_212::initiate();

}
6 changes: 3 additions & 3 deletions languages/cmb2.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# This file is distributed under the same license as the CMB2 package.
msgid ""
msgstr ""
"Project-Id-Version: CMB2 2.1.1\n"
"Project-Id-Version: CMB2 2.1.2\n"
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/cmb2\n"
"POT-Creation-Date: 2015-10-01 01:21:32+00:00\n"
"POT-Creation-Date: 2015-10-01 12:50:41+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2015-9-30 1:21+240\n"
"PO-Revision-Date: 2015-10-1 12:50+240\n"
"Last-Translator: WebDevStudios [email protected]\n"
"Language-Team: WebDevStudios [email protected]\n"
"X-Generator: grunt-wp-i18n 0.4.9\n"
Expand Down
8 changes: 7 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
**Tags:** metaboxes, forms, fields, options, settings
**Requires at least:** 3.8.0
**Tested up to:** 4.3.1
**Stable tag:** 2.1.1
**Stable tag:** 2.1.2
**License:** GPLv2 or later
**License URI:** [http://www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html)

Expand Down Expand Up @@ -107,6 +107,12 @@ If including the library in your plugin or theme:

## Most Recent Changes

### 2.1.2

#### Bug Fixes

* Fixes back-compatibility issue when adding fields array to the metabox registration. ([#472](https://github.com/WebDevStudios/CMB2/pull/472))

### 2.1.1

#### Enhancements
Expand Down
20 changes: 19 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: http://webdevstudios.com
Tags: metaboxes, forms, fields, options, settings
Requires at least: 3.8.0
Tested up to: 4.3.1
Stable tag: 2.1.1
Stable tag: 2.1.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -79,6 +79,12 @@ A complete list of all our awesome contributors found here: [github.com/WebDevSt

### Most Recent Changes

#### 2.1.2

##### Bug Fixes

* Fixes back-compatibility issue when adding fields array to the metabox registration. ([#472](https://github.com/WebDevStudios/CMB2/pull/472))

#### 2.1.1

##### Enhancements
Expand Down Expand Up @@ -134,6 +140,12 @@ FAQ's usually end up in the [github wiki](https://github.com/WebDevStudios/CMB2/

== Changelog ==

### 2.1.2 - 2015-10-01

#### Bug Fixes

* Fixes back-compatibility issue when adding fields array to the metabox registration. ([#472](https://github.com/WebDevStudios/CMB2/pull/472))

### 2.1.1 - 2015-09-30

#### Enhancements
Expand Down Expand Up @@ -528,6 +540,12 @@ It is now passed a null value vs saved value. If null is returned, default sanit

== Upgrade Notice ==

### 2.1.2 - 2015-10-01

#### Bug Fixes

* Fixes back-compatibility issue when adding fields array to the metabox registration. ([#472](https://github.com/WebDevStudios/CMB2/pull/472))

### 2.1.1 - 2015-09-30

#### Enhancements
Expand Down

0 comments on commit a04e06e

Please sign in to comment.