Skip to content
Permalink
Browse files

Fixed a bug that inline/nested field values were not saved properly i…

…n widget forms. Fixes #274.
  • Loading branch information...
michaeluno committed Jul 9, 2018
1 parent 21eef4b commit 594ce571ebe8f3c7b72fa92f4a087787d111b633
@@ -6,7 +6,7 @@
* Author: Michael Uno
* Author URI: http://en.michaeluno.jp/
* Requirements: PHP 5.2.4 or above, WordPress 3.3 or above.
* Version: 3.8.17
* Version: 3.8.18b01
*/
/**
@@ -16,7 +16,7 @@
*/
class AdminPageFrameworkLoader_Registry_Base {
const VERSION = '3.8.17'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!!
const VERSION = '3.8.18b01'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!!
const NAME = 'Admin Page Framework - Loader'; // the name is not 'Admin Page Framework' because warning messages gets confusing.
const SHORTNAME = 'Admin Page Framework'; // used for a menu title etc.
const DESCRIPTION = 'Loads Admin Page Framework which facilitates WordPress plugin and theme development.';
@@ -35,11 +35,11 @@
* @download_latest https://github.com/michaeluno/admin-page-framework/archive/master.zip
* @download_stable http://downloads.wordpress.org/plugin/admin-page-framework.latest-stable.zip
* @catchcopy The framework for all WordPress developers.
* @version 3.8.17
* @version 3.8.18b01
*/
abstract class AdminPageFramework_Registry_Base {
const VERSION = '3.8.17'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!!
const VERSION = '3.8.18b01'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!!
const NAME = 'Admin Page Framework';
const DESCRIPTION = 'Facilitates WordPress plugin and theme development.';
const URI = 'http://en.michaeluno.jp/admin-page-framework';
@@ -121,8 +121,9 @@ public function _replyToGetInputNameAttribute( /* $sNameAttribute, $aField, $sKe
'',
"[{$sKey}]"
);
return $this->_replyToGetFieldNameAttribute( '', $aField ) . $sKey;
$_sNamePrefix = $this->_replyToGetFieldNameAttribute( '', $aField );
return $_sNamePrefix . $sKey;
}
/**
@@ -279,13 +279,26 @@ public function _replyToGetFieldName( /* $sNameAttribute, array $aFieldset */ )
* @return string
*/
private function _getNameAttributeDimensions( $aFieldset ) {
$_sSectionIndex = isset( $aFieldset[ 'section_id' ], $aFieldset[ '_section_index' ] )
? "[{$aFieldset[ '_section_index' ]}]"
: "";
$_sDimensions = $this->oCaller->isSectionSet( $aFieldset )
? $aFieldset[ 'section_id' ] . "]" . $_sSectionIndex . "[" . $aFieldset[ 'field_id' ]
: $aFieldset[ 'field_id' ];
return 'widget-' . $this->id_base . '[' . $this->number . '][' . $_sDimensions . ']';
$_sNamePrefix = 'widget-' . $this->id_base . '[' . $this->number . ']';
$_sDimensions = '';
if ( $this->oCaller->isSectionSet( $aFieldset ) ) {
$_aSectionPath = $aFieldset[ '_section_path_array' ];
foreach( $_aSectionPath as $_sDimension ) {
$_sDimensions .= '[' . $_sDimension . ']';
}
if ( isset( $aFieldset[ '_section_index' ] ) ) {
$_sDimensions .= '[' . $aFieldset[ '_section_index' ] . ']';
}
}
// 3.8.18+ Support for nested fields. @see https://github.com/michaeluno/admin-page-framework/issues/274
foreach( $aFieldset[ '_field_path_array' ] as $_sPathPart ) {
$_sDimensions .= '[' . $_sPathPart . ']';
}
return $_sNamePrefix . $_sDimensions;
}
/**
@@ -303,8 +316,9 @@ public function _replyToGetFieldInputName( /* $sNameAttribute, array $aFieldset,
'0' !== $sIndex && empty( $sIndex ),
'',
"[" . $sIndex . "]"
);
return $this->_replyToGetFieldName( '', $aFieldset ) . $_sIndex;
);
$_sNamePrefix = $this->_replyToGetFieldName( '', $aFieldset );
return $_sNamePrefix . $_sIndex;
}
@@ -505,6 +505,9 @@ See examples, https://gist.github.com/michaeluno/c30713fcfe0d9d45d89f, https://g

== Changelog ==

= 3.8.18 =
- Fixed a bug that inline/nested field values were not saved properly in widget forms.

= 3.8.17 - 2018/07/09 =
- Fixed a bug that the `save` argument did not take effect for User Meta, Page Meta Box and Widget factories.
- Fixed a compatibility issue with some third-parties which attempt to instantiate the framework widget class without given any parameters.

0 comments on commit 594ce57

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.