@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | */ |
17 | 17 | class AdminPageFrameworkLoader_Registry_Base { |
18 | 18 | |
19 | - const VERSION = '3.8.13b05'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!! |
|
19 | + const VERSION = '3.8.13b05'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!! |
|
20 | 20 | const NAME = 'Admin Page Framework - Loader'; // the name is not 'Admin Page Framework' because warning messages gets confusing. |
21 | - const SHORTNAME = 'Admin Page Framework'; // used for a menu title etc. |
|
21 | + const SHORTNAME = 'Admin Page Framework'; // used for a menu title etc. |
|
22 | 22 | const DESCRIPTION = 'Loads Admin Page Framework which facilitates WordPress plugin and theme development.'; |
23 | 23 | const URI = 'http://admin-page-framework.michaeluno.jp/'; |
24 | 24 | const AUTHOR = 'miunosoft (Michael Uno)'; |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | * @remark This is also accessed from `uninstall.php` so do not remove. |
56 | 56 | * @remark Do not exceed 8 characters as a transient name allows 45 characters or less ( 40 for site transients ) so that md5 (32 characters) can be added. |
57 | 57 | */ |
58 | - const TRANSIENT_PREFIX = 'APFL_'; |
|
58 | + const TRANSIENT_PREFIX = 'APFL_'; |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * The hook slug used for the prefix of action and filter hook names. |
62 | 62 | * |
63 | 63 | * @remark The ending underscore is not necessary. |
64 | 64 | */ |
65 | - const HOOK_SLUG = 'admin_page_framework_loader'; |
|
65 | + const HOOK_SLUG = 'admin_page_framework_loader'; |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * The text domain slug and its path. |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | static public $aAdminPages = array( |
118 | 118 | // key => 'page slug' |
119 | - 'about' => 'apfl_about', // the welcome page |
|
119 | + 'about' => 'apfl_about', // the welcome page |
|
120 | 120 | 'addon' => 'apfl_addons', |
121 | 121 | 'tool' => 'apfl_tools', |
122 | 122 | 'help' => 'apfl_contact', |
@@ -154,12 +154,12 @@ discard block |
||
154 | 154 | * @since 3.5.0 |
155 | 155 | * @return string |
156 | 156 | */ |
157 | - public static function getPluginURL( $sRelativePath='' ) { |
|
157 | + public static function getPluginURL( $sRelativePath = '' ) { |
|
158 | 158 | if ( isset( self::$_sPluginURLCache ) ) { |
159 | - return self::$_sPluginURLCache . $sRelativePath; |
|
159 | + return self::$_sPluginURLCache.$sRelativePath; |
|
160 | 160 | } |
161 | 161 | self::$_sPluginURLCache = trailingslashit( plugins_url( '', self::$sFilePath ) ); |
162 | - return self::$_sPluginURLCache . $sRelativePath; |
|
162 | + return self::$_sPluginURLCache.$sRelativePath; |
|
163 | 163 | } |
164 | 164 | /** |
165 | 165 | * @since 3.7.9 |
@@ -189,13 +189,13 @@ discard block |
||
189 | 189 | * @since 3.5.0 |
190 | 190 | * @return void |
191 | 191 | */ |
192 | - static public function setAdminNotice( $sMessage, $sClassAttribute='error' ) { |
|
193 | - if ( ! is_admin() ) { |
|
192 | + static public function setAdminNotice( $sMessage, $sClassAttribute = 'error' ) { |
|
193 | + if ( !is_admin() ) { |
|
194 | 194 | return; |
195 | 195 | } |
196 | - self::$_aAdminNotices[] = array( |
|
196 | + self::$_aAdminNotices[ ] = array( |
|
197 | 197 | 'message' => $sMessage, |
198 | - 'class_attribute' => trim( $sClassAttribute ) . ' notice is-dismissible', |
|
198 | + 'class_attribute' => trim( $sClassAttribute ).' notice is-dismissible', |
|
199 | 199 | ); |
200 | 200 | add_action( 'admin_notices', array( __CLASS__, '_replyToSetAdminNotice' ) ); |
201 | 201 | } |
@@ -205,12 +205,12 @@ discard block |
||
205 | 205 | * @return void |
206 | 206 | */ |
207 | 207 | static public function _replyToSetAdminNotice() { |
208 | - foreach( self::$_aAdminNotices as $_aAdminNotice ) { |
|
209 | - echo "<div class='" . esc_attr( $_aAdminNotice['class_attribute'] ) . " notice is-dismissible'>" |
|
208 | + foreach ( self::$_aAdminNotices as $_aAdminNotice ) { |
|
209 | + echo "<div class='".esc_attr( $_aAdminNotice[ 'class_attribute' ] )." notice is-dismissible'>" |
|
210 | 210 | ."<p>" |
211 | 211 | . sprintf( |
212 | - '<strong>%1$s</strong>: ' . $_aAdminNotice['message'], |
|
213 | - self::NAME . ' ' . self::VERSION |
|
212 | + '<strong>%1$s</strong>: '.$_aAdminNotice[ 'message' ], |
|
213 | + self::NAME.' '.self::VERSION |
|
214 | 214 | ) |
215 | 215 | . "</p>" |
216 | 216 | . "</div>"; |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | AdminPageFrameworkLoader_Registry::setUp( __FILE__ ); |
223 | 223 | |
224 | 224 | // Initial checks. - Do no load if accessed directly, not exiting because the 'uninstall.php' and inclusion list generator will load this file. |
225 | -if ( ! defined( 'ABSPATH' ) ) { |
|
225 | +if ( !defined( 'ABSPATH' ) ) { |
|
226 | 226 | return; |
227 | 227 | } |
228 | 228 | if ( defined( 'DOING_UNINSTALL' ) && DOING_UNINSTALL ) { |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | |
235 | 235 | $_bFrameworkLoaded = class_exists( 'AdminPageFramework_Registry', false ); |
236 | 236 | if ( |
237 | - ! $_bFrameworkLoaded |
|
238 | - || ! defined( 'AdminPageFramework_Registry::VERSION' ) // backward compatibility |
|
237 | + !$_bFrameworkLoaded |
|
238 | + || !defined( 'AdminPageFramework_Registry::VERSION' ) // backward compatibility |
|
239 | 239 | || version_compare( AdminPageFramework_Registry::VERSION, AdminPageFrameworkLoader_Registry::VERSION, '<' ) |
240 | 240 | ) { |
241 | 241 | AdminPageFrameworkLoader_Registry::setAdminNotice( |
@@ -253,18 +253,18 @@ discard block |
||
253 | 253 | add_action( 'admin_init', 'AdminPageFrameworkLoader_Warning' ); |
254 | 254 | |
255 | 255 | // Include the library file - the development version will be available if you cloned the GitHub repository. |
256 | -$_sDevelopmentVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath . '/development/admin-page-framework.php'; |
|
256 | +$_sDevelopmentVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath.'/development/admin-page-framework.php'; |
|
257 | 257 | $_bDebugMode = defined( 'WP_DEBUG' ) && WP_DEBUG; |
258 | 258 | $_bLoadDevelopmentVersion = $_bDebugMode && file_exists( $_sDevelopmentVersionPath ); |
259 | 259 | include( |
260 | 260 | $_bLoadDevelopmentVersion |
261 | 261 | ? $_sDevelopmentVersionPath |
262 | - : AdminPageFrameworkLoader_Registry::$sDirPath . '/library/apf/admin-page-framework.php' |
|
262 | + : AdminPageFrameworkLoader_Registry::$sDirPath.'/library/apf/admin-page-framework.php' |
|
263 | 263 | ); |
264 | 264 | |
265 | 265 | // Include the framework loader plugin components. |
266 | 266 | include( AdminPageFramework_Registry::$aClassFiles[ 'AdminPageFramework_PluginBootstrap' ] ); |
267 | -include( AdminPageFrameworkLoader_Registry::$sDirPath . '/include/class/AdminPageFrameworkLoader_Bootstrap.php' ); |
|
267 | +include( AdminPageFrameworkLoader_Registry::$sDirPath.'/include/class/AdminPageFrameworkLoader_Bootstrap.php' ); |
|
268 | 268 | new AdminPageFrameworkLoader_Bootstrap( |
269 | 269 | AdminPageFrameworkLoader_Registry::$sFilePath, |
270 | 270 | AdminPageFrameworkLoader_Registry::HOOK_SLUG // hook prefix |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | public function get() { |
57 | 57 | |
58 | 58 | // Get the set value(s) |
59 | - $_mSavedValue = $this->_getStoredInputFieldValue( |
|
59 | + $_mSavedValue = $this->_getStoredInputFieldValue( |
|
60 | 60 | $this->aField, |
61 | 61 | $this->aOptions |
62 | 62 | ); |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | * @return void |
117 | 117 | */ |
118 | 118 | private function _divideMainAndSubFields( $aField, array &$aFirstField, array &$aSubFields ) { |
119 | - foreach( $aField as $_nsIndex => $_mFieldElement ) { |
|
119 | + foreach ( $aField as $_nsIndex => $_mFieldElement ) { |
|
120 | 120 | if ( is_numeric( $_nsIndex ) ) { |
121 | - $aSubFields[] = $_mFieldElement; |
|
121 | + $aSubFields[ ] = $_mFieldElement; |
|
122 | 122 | } else { |
123 | 123 | $aFirstField[ $_nsIndex ] = $_mFieldElement; |
124 | 124 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | // We are collecting elements from the second sub-field. |
145 | 145 | unset( $_aSavedValues[ 0 ] ); |
146 | 146 | |
147 | - foreach( $_aSavedValues as $_iIndex => $vValue ) { |
|
147 | + foreach ( $_aSavedValues as $_iIndex => $vValue ) { |
|
148 | 148 | $aSubFields[ $_iIndex - 1 ] = isset( $aSubFields[ $_iIndex - 1 ] ) && is_array( $aSubFields[ $_iIndex - 1 ] ) |
149 | 149 | ? $aSubFields[ $_iIndex - 1 ] |
150 | 150 | : array(); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | */ |
160 | 160 | private function _fillSubFields( array &$aSubFields, array $aFirstField ) { |
161 | 161 | |
162 | - foreach( $aSubFields as &$_aSubField ) { |
|
162 | + foreach ( $aSubFields as &$_aSubField ) { |
|
163 | 163 | |
164 | 164 | // Evacuate the label element which should not be merged. |
165 | 165 | $_aLabel = $this->getElement( |
@@ -190,15 +190,15 @@ discard block |
||
190 | 190 | |
191 | 191 | // Determine whether the elements are saved in an array. |
192 | 192 | // $_bHasSubFields = count( $aFields ) > 1 || $aField[ 'repeatable' ] || $aField[ 'sortable' ]; |
193 | - if ( ! $this->hasSubFields( $aFields, $aField ) ) { |
|
193 | + if ( !$this->hasSubFields( $aFields, $aField ) ) { |
|
194 | 194 | $aFields[ 0 ][ '_saved_value' ] = $mSavedValue; |
195 | 195 | $aFields[ 0 ][ '_is_multiple_fields' ] = false; |
196 | 196 | return; |
197 | 197 | } |
198 | 198 | |
199 | - foreach( $aFields as $_iIndex => &$_aThisField ) { |
|
199 | + foreach ( $aFields as $_iIndex => &$_aThisField ) { |
|
200 | 200 | $_aThisField[ '_saved_value' ] = $this->getElement( $mSavedValue, $_iIndex, null ); |
201 | - $_aThisField[ '_subfield_index' ] = $_iIndex; // 3.8.0+ |
|
201 | + $_aThisField[ '_subfield_index' ] = $_iIndex; // 3.8.0+ |
|
202 | 202 | $_aThisField[ '_is_multiple_fields' ] = true; |
203 | 203 | } |
204 | 204 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * @since 3.6.0 Moved from `AdminPageFramework_FieldDefinition`. |
213 | 213 | */ |
214 | 214 | private function _setFieldsValue( &$aFields ) { |
215 | - foreach( $aFields as &$_aField ) { |
|
215 | + foreach ( $aFields as &$_aField ) { |
|
216 | 216 | $_aField[ '_is_value_set_by_user' ] = isset( $_aField[ 'value' ] ); |
217 | 217 | $_aField[ 'value' ] = $this->_getSetFieldValue( $_aField ); |
218 | 218 | } |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | */ |
258 | 258 | private function _getStoredInputFieldValue( $aField, $aOptions ) { |
259 | 259 | |
260 | - $_aFieldPath = $aField[ '_field_path_array' ]; |
|
260 | + $_aFieldPath = $aField[ '_field_path_array' ]; |
|
261 | 261 | |
262 | 262 | // If a section is not set, check the first dimension element. |
263 | - if ( ! isset( $aField[ 'section_id' ] ) || '_default' === $aField[ 'section_id' ] ) { |
|
263 | + if ( !isset( $aField[ 'section_id' ] ) || '_default' === $aField[ 'section_id' ] ) { |
|
264 | 264 | return $this->getElement( |
265 | 265 | $aOptions, |
266 | 266 | $_aFieldPath, // $aField[ 'field_id' ], // @todo this may have to be a field path instead of field id. |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | * @since 3.8.13 |
37 | 37 | */ |
38 | 38 | static protected $_aStructure_Disabled = array( |
39 | - 'label' => 'The ability of repeating sections is disabled.', // will be reassigned |
|
40 | - 'caption' => 'Warning', // will be reassigned |
|
39 | + 'label' => 'The ability of repeating sections is disabled.', // will be reassigned |
|
40 | + 'caption' => 'Warning', // will be reassigned |
|
41 | 41 | 'box_width' => 300, |
42 | 42 | 'box_height' => 100, |
43 | 43 | ); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function __construct( /* array $asArguments, $oMsg */ ) { |
56 | 56 | |
57 | - $_aParameters = func_get_args() + array( |
|
57 | + $_aParameters = func_get_args() + array( |
|
58 | 58 | $this->_aArguments, |
59 | 59 | null |
60 | 60 | ); |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | public function get() { |
74 | 74 | |
75 | 75 | $_aArguments = $this->_aArguments + self::$_aStructure; |
76 | - unset( $_aArguments[ 0 ] ); // remove the 0 index element converted from `'repeatable => 'true',`. |
|
77 | - if ( ! empty( $_aArguments[ 'disabled' ] ) ) { |
|
76 | + unset( $_aArguments[ 0 ] ); // remove the 0 index element converted from `'repeatable => 'true',`. |
|
77 | + if ( !empty( $_aArguments[ 'disabled' ] ) ) { |
|
78 | 78 | $_aArguments[ 'disabled' ] = $_aArguments[ 'disabled' ] + array( |
79 | 79 | 'label' => $this->_getDefaultMessage(), |
80 | 80 | 'caption' => $this->_oMsg->get( 'warning_caption' ), |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | static public function hasNestedFields( array $aFieldset ) { |
61 | 61 | |
62 | - if ( ! self::hasFieldDefinitionsInContent( $aFieldset ) ) { |
|
62 | + if ( !self::hasFieldDefinitionsInContent( $aFieldset ) ) { |
|
63 | 63 | return false; |
64 | 64 | } |
65 | 65 | // At this point, the `content` argument contains either the definition of nested fields or inline-mixed fields. |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | static public function hasFieldDefinitionsInContent( array $aFieldset ) { |
105 | 105 | |
106 | - if ( ! isset( $aFieldset[ 'content' ] ) ) { |
|
106 | + if ( !isset( $aFieldset[ 'content' ] ) ) { |
|
107 | 107 | return false; |
108 | 108 | } |
109 | 109 | if ( empty( $aFieldset[ 'content' ] ) ) { |
@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | * @since 3.8.13 |
139 | 139 | */ |
140 | 140 | static public function isDynamicField( $aField ) { |
141 | - if ( ! empty( $aField[ 'repeatable' ] ) ) { |
|
141 | + if ( !empty( $aField[ 'repeatable' ] ) ) { |
|
142 | 142 | return true; |
143 | 143 | } |
144 | - if ( ! empty( $aField[ 'sortable' ] ) ) { |
|
144 | + if ( !empty( $aField[ 'sortable' ] ) ) { |
|
145 | 145 | return true; |
146 | 146 | } |
147 | 147 | return false; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | if ( empty( $sString ) ) { |
171 | 171 | return $sString; |
172 | 172 | } |
173 | - return $sString . '|'; |
|
173 | + return $sString.'|'; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -186,17 +186,17 @@ discard block |
||
186 | 186 | */ |
187 | 187 | static public function getFieldsetReformattedBySubFieldIndex( array $aFieldset, $iSubFieldIndex, $bHasSubFields, array $aParentFieldset ) { |
188 | 188 | |
189 | - $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
189 | + $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
190 | 190 | |
191 | 191 | // Add sub-field index to the parent field path for repeated nested items. |
192 | - $aFieldset[ '_parent_field_path' ] = self::getAOrB( |
|
192 | + $aFieldset[ '_parent_field_path' ] = self::getAOrB( |
|
193 | 193 | $bHasSubFields, |
194 | - $aFieldset[ '_parent_field_path' ] . '|' . $iSubFieldIndex, |
|
194 | + $aFieldset[ '_parent_field_path' ].'|'.$iSubFieldIndex, |
|
195 | 195 | $aFieldset[ '_parent_field_path' ] |
196 | 196 | ); |
197 | - $aFieldset[ '_parent_tag_id' ] = self::getAOrB( |
|
197 | + $aFieldset[ '_parent_tag_id' ] = self::getAOrB( |
|
198 | 198 | $bHasSubFields, |
199 | - $aParentFieldset[ 'tag_id' ] . '__' . $iSubFieldIndex, |
|
199 | + $aParentFieldset[ 'tag_id' ].'__'.$iSubFieldIndex, |
|
200 | 200 | $aParentFieldset[ 'tag_id' ] |
201 | 201 | ); |
202 | 202 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $aFieldset, |
206 | 206 | $aFieldset[ '_structure_type' ], |
207 | 207 | $aFieldset[ 'capability' ], |
208 | - ( integer ) $iSubFieldIndex + 1, // 1-based count (not index) |
|
208 | + ( integer ) $iSubFieldIndex + 1, // 1-based count (not index) |
|
209 | 209 | $aFieldset[ '_subsection_index' ], |
210 | 210 | $aFieldset[ '_is_section_repeatable' ], |
211 | 211 | $aFieldset[ '_caller_object' ] |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | $_oFieldsetOutputFormatter = new AdminPageFramework_Form_Model___Format_FieldsetOutput( |
216 | 216 | $aFieldset, |
217 | - $aFieldset[ '_section_index' ], // `_section_index` is defined in the ...FieldsetOutput class. Since this is a nested item, it should be already set. |
|
217 | + $aFieldset[ '_section_index' ], // `_section_index` is defined in the ...FieldsetOutput class. Since this is a nested item, it should be already set. |
|
218 | 218 | $_oCallerForm->aFieldTypeDefinitions |
219 | 219 | ); |
220 | 220 | return $_oFieldsetOutputFormatter->get(); |
@@ -251,12 +251,12 @@ discard block |
||
251 | 251 | if ( empty( $aArguments ) ) { |
252 | 252 | return ''; |
253 | 253 | } |
254 | - if ( self::hasBeenCalled( 'disabled_repeatable_elements_modal_' . $sBoxElementID ) ) { |
|
254 | + if ( self::hasBeenCalled( 'disabled_repeatable_elements_modal_'.$sBoxElementID ) ) { |
|
255 | 255 | return ''; |
256 | 256 | } |
257 | 257 | add_thickbox(); // to display a message to the user. |
258 | 258 | return "<div id='{$sBoxElementID}' style='display:none'>" |
259 | - . "<p>" . $aArguments[ 'label' ] . "</p>" |
|
259 | + . "<p>".$aArguments[ 'label' ]."</p>" |
|
260 | 260 | . "</div>"; |
261 | 261 | |
262 | 262 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $this->aAttributes, |
40 | 40 | $this->iFieldsCount, |
41 | 41 | ); |
42 | - $this->aArguments = $_aParameters[ 0 ]; |
|
42 | + $this->aArguments = $_aParameters[ 0 ]; |
|
43 | 43 | $this->aAttributes = $_aParameters[ 1 ]; |
44 | 44 | $this->iFieldsCount = $_aParameters[ 2 ]; |
45 | 45 | |
@@ -52,17 +52,17 @@ discard block |
||
52 | 52 | */ |
53 | 53 | protected function _getAttributes() { |
54 | 54 | return array( |
55 | - 'id' => $this->sContext . '-' . $this->aArguments[ 'tag_id' ], |
|
56 | - 'class' => 'admin-page-framework-' . $this->sContext |
|
57 | - . $this->getAOrB( ! empty( $this->aArguments[ 'repeatable' ] ), ' repeatable dynamic-fields', '' ) // 3.6.0+ Added the 'dynamic-fields' class selector. |
|
58 | - . $this->getAOrB( ! empty( $this->aArguments[ 'sortable' ] ), ' sortable dynamic-fields', '' ), |
|
55 | + 'id' => $this->sContext.'-'.$this->aArguments[ 'tag_id' ], |
|
56 | + 'class' => 'admin-page-framework-'.$this->sContext |
|
57 | + . $this->getAOrB( !empty( $this->aArguments[ 'repeatable' ] ), ' repeatable dynamic-fields', '' ) // 3.6.0+ Added the 'dynamic-fields' class selector. |
|
58 | + . $this->getAOrB( !empty( $this->aArguments[ 'sortable' ] ), ' sortable dynamic-fields', '' ), |
|
59 | 59 | |
60 | 60 | // referred by the sortable field JavaScript script. |
61 | 61 | 'data-type' => $this->aArguments[ 'type' ], |
62 | 62 | |
63 | 63 | // 3.6.0+ Stores the total number of dynamic fields, used to generate the input id and name of repeated fields which contain an incremented index number. |
64 | 64 | 'data-largest_index' => max( |
65 | - ( int ) $this->iFieldsCount - 1, // zero-base index |
|
65 | + ( int ) $this->iFieldsCount - 1, // zero-base index |
|
66 | 66 | 0 |
67 | 67 | ), // convert negative numbers to zero. |
68 | 68 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $this->aFieldset[ '_field_path_array' ], |
39 | 39 | $this->aFieldset[ 'error_message' ] |
40 | 40 | ); |
41 | - $_aOutputs[] = $_oFieldError->get(); |
|
41 | + $_aOutputs[ ] = $_oFieldError->get(); |
|
42 | 42 | |
43 | 43 | // 2. Construct fields array for sub-fields. |
44 | 44 | $_oFieldsFormatter = new AdminPageFramework_Form_Model___Format_Fields( |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $_aFields = $_oFieldsFormatter->get(); |
49 | 49 | |
50 | 50 | // 3. Get the field and its sub-fields output. |
51 | - $_aOutputs[] = $this->_getFieldsOutput( |
|
51 | + $_aOutputs[ ] = $this->_getFieldsOutput( |
|
52 | 52 | $this->aFieldset, |
53 | 53 | $_aFields, |
54 | 54 | $this->aCallbacks |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | * @since 3.8.0 Added the `$aFieldset` parameter |
72 | 72 | * @return string |
73 | 73 | */ |
74 | - private function _getFieldsOutput( $aFieldset, array $aFields, array $aCallbacks=array() ) { |
|
74 | + private function _getFieldsOutput( $aFieldset, array $aFields, array $aCallbacks = array() ) { |
|
75 | 75 | |
76 | 76 | $_aOutput = array(); |
77 | - foreach( $aFields as $_isIndex => $_aField ) { |
|
78 | - $_aOutput[] = $this->_getEachFieldOutput( |
|
77 | + foreach ( $aFields as $_isIndex => $_aField ) { |
|
78 | + $_aOutput[ ] = $this->_getEachFieldOutput( |
|
79 | 79 | $_aField, |
80 | 80 | $_isIndex, |
81 | 81 | $aCallbacks, |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | * @since 3.5.3 |
95 | 95 | * @return string the HTML output of the given field. |
96 | 96 | */ |
97 | - private function _getEachFieldOutput( $aField, $isIndex, array $aCallbacks, $bIsLastElement=false ) { |
|
97 | + private function _getEachFieldOutput( $aField, $isIndex, array $aCallbacks, $bIsLastElement = false ) { |
|
98 | 98 | |
99 | 99 | // Field type definition - allows mixed field types in sub-fields |
100 | 100 | $_aFieldTypeDefinition = $this->_getFieldTypeDefinition( $aField[ 'type' ] ); |
101 | - if ( ! is_callable( $_aFieldTypeDefinition[ 'hfRenderField' ] ) ) { |
|
101 | + if ( !is_callable( $_aFieldTypeDefinition[ 'hfRenderField' ] ) ) { |
|
102 | 102 | return ''; |
103 | 103 | } |
104 | 104 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | private function _getFieldOutput( $sContent, $aField, $bIsLastElement ) { |
133 | 133 | $_oFieldAttribute = new AdminPageFramework_Form_View___Attribute_Field( $aField ); |
134 | 134 | return $aField[ 'before_field' ] |
135 | - . "<div " . $_oFieldAttribute->get() . ">" |
|
135 | + . "<div ".$_oFieldAttribute->get().">" |
|
136 | 136 | . $sContent |
137 | 137 | . $this->_getUnsetFlagFieldInputTag( $aField ) |
138 | 138 | . $this->_getDelimiter( $aField, $bIsLastElement ) |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | 'input', |
155 | 155 | array( |
156 | 156 | 'type' => 'hidden', |
157 | - 'name' => '__unset_' . $aField[ '_fields_type' ] . '[' . $aField[ '_input_name_flat' ] . ']', |
|
157 | + 'name' => '__unset_'.$aField[ '_fields_type' ].'['.$aField[ '_input_name_flat' ].']', |
|
158 | 158 | 'value' => $aField[ '_input_name_flat' ], |
159 | 159 | 'class' => 'unset-element-names element-address', |
160 | 160 | ) |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | private function _getDelimiter( $aField, $bIsLastElement ) { |
187 | 187 | return $aField[ 'delimiter' ] |
188 | - ? "<div " . $this->getAttributes( |
|
188 | + ? "<div ".$this->getAttributes( |
|
189 | 189 | array( |
190 | 190 | 'class' => 'delimiter', |
191 | 191 | 'id' => "delimiter-{$aField[ 'input_id' ]}", |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | "" |
196 | 196 | ), |
197 | 197 | ) |
198 | - ) . ">" |
|
198 | + ).">" |
|
199 | 199 | . $aField[ 'delimiter' ] |
200 | 200 | . "</div>" |
201 | 201 | : ''; |
@@ -209,9 +209,9 @@ discard block |
||
209 | 209 | */ |
210 | 210 | private function _getFinalOutput( $aFieldset, array $aFieldsOutput, $iFieldsCount ) { |
211 | 211 | |
212 | - $_oFieldsetAttributes = new AdminPageFramework_Form_View___Attribute_Fieldset( $aFieldset ); |
|
212 | + $_oFieldsetAttributes = new AdminPageFramework_Form_View___Attribute_Fieldset( $aFieldset ); |
|
213 | 213 | return $aFieldset[ 'before_fieldset' ] |
214 | - . "<fieldset " . $_oFieldsetAttributes->get() . ">" |
|
214 | + . "<fieldset ".$_oFieldsetAttributes->get().">" |
|
215 | 215 | . $this->_getEmbeddedFieldTitle( $aFieldset ) |
216 | 216 | . $this->_getChildFieldTitle( $aFieldset ) |
217 | 217 | . $this->_getFieldsetContent( $aFieldset, $aFieldsOutput, $iFieldsCount ) |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | private function _getEmbeddedFieldTitle( $aFieldset ) { |
230 | 230 | |
231 | - if ( ! $aFieldset[ '_is_title_embedded' ] ) { |
|
231 | + if ( !$aFieldset[ '_is_title_embedded' ] ) { |
|
232 | 232 | return ''; |
233 | 233 | } |
234 | 234 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | */ |
254 | 254 | private function _getChildFieldTitle( $aFieldset ) { |
255 | 255 | |
256 | - if ( ! $aFieldset[ '_nested_depth' ] ) { |
|
256 | + if ( !$aFieldset[ '_nested_depth' ] ) { |
|
257 | 257 | return ''; |
258 | 258 | } |
259 | 259 | if ( $aFieldset[ '_is_title_embedded' ] ) { |
@@ -282,12 +282,12 @@ discard block |
||
282 | 282 | return $aFieldset[ 'content' ]; |
283 | 283 | } |
284 | 284 | |
285 | - $_oFieldsAttributes = new AdminPageFramework_Form_View___Attribute_Fields( |
|
285 | + $_oFieldsAttributes = new AdminPageFramework_Form_View___Attribute_Fields( |
|
286 | 286 | $aFieldset, |
287 | - array(), // attribute array |
|
287 | + array(), // attribute array |
|
288 | 288 | $iFieldsCount |
289 | 289 | ); |
290 | - return "<div " . $_oFieldsAttributes->get() . ">" |
|
290 | + return "<div ".$_oFieldsAttributes->get().">" |
|
291 | 291 | . $aFieldset[ 'before_fields' ] |
292 | 292 | . implode( PHP_EOL, $aFieldsOutput ) |
293 | 293 | . $aFieldset[ 'after_fields' ] |
@@ -310,13 +310,13 @@ discard block |
||
310 | 310 | $aField[ 'description' ], |
311 | 311 | 'admin-page-framework-fields-description' // class selector |
312 | 312 | ); |
313 | - $_aOutput[] = $_oFieldDescription->get(); |
|
313 | + $_aOutput[ ] = $_oFieldDescription->get(); |
|
314 | 314 | |
315 | 315 | // Dimensional keys of repeatable and sortable fields |
316 | - $_aOutput[] = $this->_getDynamicElementFlagFieldInputTag( $aField ); |
|
316 | + $_aOutput[ ] = $this->_getDynamicElementFlagFieldInputTag( $aField ); |
|
317 | 317 | |
318 | 318 | // Repeatable and sortable scripts |
319 | - $_aOutput[] = $this->_getFieldScripts( $aField, $iFieldsCount ); |
|
319 | + $_aOutput[ ] = $this->_getFieldScripts( $aField, $iFieldsCount ); |
|
320 | 320 | |
321 | 321 | return implode( PHP_EOL, array_filter( $_aOutput ) ); |
322 | 322 | |
@@ -328,10 +328,10 @@ discard block |
||
328 | 328 | */ |
329 | 329 | private function _getDynamicElementFlagFieldInputTag( $aFieldset ) { |
330 | 330 | |
331 | - if ( ! empty( $aFieldset[ 'repeatable' ] ) ) { |
|
331 | + if ( !empty( $aFieldset[ 'repeatable' ] ) ) { |
|
332 | 332 | return $this->_getRepeatableFieldFlagTag( $aFieldset ); |
333 | 333 | } |
334 | - if ( ! empty( $aFieldset[ 'sortable' ] ) ) { |
|
334 | + if ( !empty( $aFieldset[ 'sortable' ] ) ) { |
|
335 | 335 | return $this->_getSortableFieldFlagTag( $aFieldset ); |
336 | 336 | } |
337 | 337 | return ''; |
@@ -346,8 +346,8 @@ discard block |
||
346 | 346 | 'input', |
347 | 347 | array( |
348 | 348 | 'type' => 'hidden', |
349 | - 'name' => '__repeatable_elements_' . $aFieldset[ '_structure_type' ] |
|
350 | - . '[' . $aFieldset[ '_field_address' ] . ']', |
|
349 | + 'name' => '__repeatable_elements_'.$aFieldset[ '_structure_type' ] |
|
350 | + . '['.$aFieldset[ '_field_address' ].']', |
|
351 | 351 | 'class' => 'element-address', |
352 | 352 | 'value' => $aFieldset[ '_field_address' ], |
353 | 353 | 'data-field_address_model' => $aFieldset[ '_field_address_model' ], |
@@ -363,8 +363,8 @@ discard block |
||
363 | 363 | 'input', |
364 | 364 | array( |
365 | 365 | 'type' => 'hidden', |
366 | - 'name' => '__sortable_elements_' . $aFieldset[ '_structure_type' ] |
|
367 | - . '[' . $aFieldset[ '_field_address' ] . ']', |
|
366 | + 'name' => '__sortable_elements_'.$aFieldset[ '_structure_type' ] |
|
367 | + . '['.$aFieldset[ '_field_address' ].']', |
|
368 | 368 | 'class' => 'element-address', |
369 | 369 | 'value' => $aFieldset[ '_field_address' ], |
370 | 370 | 'data-field_address_model' => $aFieldset[ '_field_address_model' ], |
@@ -383,14 +383,14 @@ discard block |
||
383 | 383 | $_aOutput = array(); |
384 | 384 | |
385 | 385 | // Add the repeater script |
386 | - $_aOutput[] = ! empty( $aField[ 'repeatable' ] ) |
|
387 | - ? $this->_getRepeaterFieldEnablerScript( 'fields-' . $aField[ 'tag_id' ], $iFieldsCount, $aField[ 'repeatable' ] ) |
|
386 | + $_aOutput[ ] = !empty( $aField[ 'repeatable' ] ) |
|
387 | + ? $this->_getRepeaterFieldEnablerScript( 'fields-'.$aField[ 'tag_id' ], $iFieldsCount, $aField[ 'repeatable' ] ) |
|
388 | 388 | : ''; |
389 | 389 | |
390 | 390 | // Add the sortable script - if the number of fields is only one, no need to sort the field. |
391 | 391 | // Repeatable fields can make the number increase so here it checks the repeatability. |
392 | - $_aOutput[] = ! empty( $aField[ 'sortable' ] ) && ( $iFieldsCount > 1 || ! empty( $aField[ 'repeatable' ] ) ) |
|
393 | - ? $this->_getSortableFieldEnablerScript( 'fields-' . $aField[ 'tag_id' ] ) |
|
392 | + $_aOutput[ ] = !empty( $aField[ 'sortable' ] ) && ( $iFieldsCount > 1 || !empty( $aField[ 'repeatable' ] ) ) |
|
393 | + ? $this->_getSortableFieldEnablerScript( 'fields-'.$aField[ 'tag_id' ] ) |
|
394 | 394 | : ''; |
395 | 395 | |
396 | 396 | return implode( PHP_EOL, $_aOutput ); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param object $oMsg An object storing the system messages. |
69 | 69 | * @param array $aCallbacks An array storing the form-field specific callbacks. |
70 | 70 | */ |
71 | - public function __construct( $aFieldset, $aOptions, $aErrors, &$aFieldTypeDefinitions, &$oMsg, array $aCallbacks=array() ) { |
|
71 | + public function __construct( $aFieldset, $aOptions, $aErrors, &$aFieldTypeDefinitions, &$oMsg, array $aCallbacks = array() ) { |
|
72 | 72 | |
73 | 73 | // Set up the properties that will be accessed later in the methods. |
74 | 74 | $this->aFieldset = $this->_getFormatted( $aFieldset, $aFieldTypeDefinitions ); |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | $this->aErrors = $this->getAsArray( $aErrors ); |
78 | 78 | $this->oMsg = $oMsg; |
79 | 79 | $this->aCallbacks = $aCallbacks + array( |
80 | - 'hfID' => null, // the input id attribute |
|
81 | - 'hfTagID' => null, // the fieldset/field row container id attribute |
|
82 | - 'hfName' => null, // the input name attribute |
|
83 | - 'hfNameFlat' => null, // the flat input name attribute |
|
80 | + 'hfID' => null, // the input id attribute |
|
81 | + 'hfTagID' => null, // the fieldset/field row container id attribute |
|
82 | + 'hfName' => null, // the input name attribute |
|
83 | + 'hfNameFlat' => null, // the flat input name attribute |
|
84 | 84 | 'hfInputName' => null, |
85 | 85 | 'hfInputNameFlat' => null, |
86 | - 'hfClass' => null, // the class attribute |
|
86 | + 'hfClass' => null, // the class attribute |
|
87 | 87 | ); |
88 | 88 | |
89 | 89 | // 2. Load necessary JavaScript scripts. |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | * @since 3.2.0 Added the `$sFieldsType` parameter. |
151 | 151 | * @internal |
152 | 152 | */ |
153 | - private function _loadScripts( $sStructureType='' ) { |
|
153 | + private function _loadScripts( $sStructureType = '' ) { |
|
154 | 154 | |
155 | - if ( 'widget' === $sStructureType && ! self::$_bIsLoadedJSScripts_Widget ) { |
|
155 | + if ( 'widget' === $sStructureType && !self::$_bIsLoadedJSScripts_Widget ) { |
|
156 | 156 | new AdminPageFramework_Form_View___Script_Widget; |
157 | 157 | self::$_bIsLoadedJSScripts_Widget = true; |
158 | 158 | } |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | */ |
178 | 178 | protected function _getRepeaterFieldEnablerScript( $sFieldsContainerID, $iFieldCount, $aSettings ) { |
179 | 179 | |
180 | - $_sSmallButtons = '"' . $this->___getRepeatableButtonHTML( $sFieldsContainerID, ( array ) $aSettings, $iFieldCount, true ) . '"'; |
|
181 | - $_sNestedFieldsButtons = '"' . $this->___getRepeatableButtonHTML( $sFieldsContainerID, ( array ) $aSettings, $iFieldCount, false ) . '"'; |
|
180 | + $_sSmallButtons = '"'.$this->___getRepeatableButtonHTML( $sFieldsContainerID, ( array ) $aSettings, $iFieldCount, true ).'"'; |
|
181 | + $_sNestedFieldsButtons = '"'.$this->___getRepeatableButtonHTML( $sFieldsContainerID, ( array ) $aSettings, $iFieldCount, false ).'"'; |
|
182 | 182 | $_aJSArray = json_encode( $aSettings ); |
183 | 183 | $_sScript = <<<JAVASCRIPTS |
184 | 184 | jQuery( document ).ready( function() { |
@@ -224,34 +224,34 @@ discard block |
||
224 | 224 | * @since 3.8.0 |
225 | 225 | * @return string |
226 | 226 | */ |
227 | - private function ___getRepeatableButtonHTML( $sFieldsContainerID, array $aArguments, $iFieldCount, $bSmall=true ) { |
|
227 | + private function ___getRepeatableButtonHTML( $sFieldsContainerID, array $aArguments, $iFieldCount, $bSmall = true ) { |
|
228 | 228 | |
229 | 229 | // @todo Move this formatting routine to the field-set formatter class. |
230 | 230 | $_oFormatter = new AdminPageFramework_Form_Model___Format_RepeatableField( $aArguments, $this->oMsg ); |
231 | 231 | $_aArguments = $_oFormatter->get(); |
232 | 232 | $_sSmallButtonSelector = $bSmall ? ' button-small' : ''; |
233 | 233 | $_aMinusButtonAttributes = array( |
234 | - 'class' => 'repeatable-field-remove-button button-secondary repeatable-field-button button' . $_sSmallButtonSelector, |
|
234 | + 'class' => 'repeatable-field-remove-button button-secondary repeatable-field-button button'.$_sSmallButtonSelector, |
|
235 | 235 | 'title' => $this->oMsg->get( 'remove' ), |
236 | 236 | 'style' => $iFieldCount <= 1 ? 'visibility: hidden' : null, |
237 | 237 | 'data-id' => $sFieldsContainerID, |
238 | 238 | ); |
239 | - $_sPlusButtonAttributes = array( |
|
240 | - 'class' => 'repeatable-field-add-button button-secondary repeatable-field-button button' . $_sSmallButtonSelector, |
|
239 | + $_sPlusButtonAttributes = array( |
|
240 | + 'class' => 'repeatable-field-add-button button-secondary repeatable-field-button button'.$_sSmallButtonSelector, |
|
241 | 241 | 'title' => $this->oMsg->get( 'add' ), |
242 | 242 | 'data-id' => $sFieldsContainerID, |
243 | 243 | 'href' => empty( $_aArguments[ 'disabled' ] ) |
244 | 244 | ? null |
245 | - : '#TB_inline?width=' . $aArguments[ 'disabled' ][ 'box_width' ] |
|
246 | - . '&height=' . $aArguments[ 'disabled' ][ 'box_height' ] |
|
247 | - . '&inlineId=' . 'repeatable_field_disabled_' . $sFieldsContainerID, |
|
245 | + : '#TB_inline?width='.$aArguments[ 'disabled' ][ 'box_width' ] |
|
246 | + . '&height='.$aArguments[ 'disabled' ][ 'box_height' ] |
|
247 | + . '&inlineId='.'repeatable_field_disabled_'.$sFieldsContainerID, |
|
248 | 248 | ); |
249 | - return "<div class='admin-page-framework-repeatable-field-buttons' " . $this->getDataAttributes( $_aArguments ) . " >" |
|
250 | - . "<a " . $this->getAttributes( $_aMinusButtonAttributes ) . ">-</a>" |
|
251 | - . "<a " . $this->getAttributes( $_sPlusButtonAttributes ) . ">+</a>" |
|
249 | + return "<div class='admin-page-framework-repeatable-field-buttons' ".$this->getDataAttributes( $_aArguments )." >" |
|
250 | + . "<a ".$this->getAttributes( $_aMinusButtonAttributes ).">-</a>" |
|
251 | + . "<a ".$this->getAttributes( $_sPlusButtonAttributes ).">+</a>" |
|
252 | 252 | . "</div>" |
253 | 253 | . $this->getModalForDisabledRepeatableElement( |
254 | - 'repeatable_field_disabled_' . $sFieldsContainerID, |
|
254 | + 'repeatable_field_disabled_'.$sFieldsContainerID, |
|
255 | 255 | $_aArguments[ 'disabled' ] |
256 | 256 | ); |
257 | 257 |
@@ -513,7 +513,7 @@ |
||
513 | 513 | static private function ___getRemoveButtonAttributes( $sContainerTagID, $oMsg, $iSectionCount ) { |
514 | 514 | return array( |
515 | 515 | 'class' => 'repeatable-section-remove-button button-secondary ' |
516 | - . 'repeatable-section-button button button-large', |
|
516 | + . 'repeatable-section-button button button-large', |
|
517 | 517 | 'title' => $oMsg->get( 'remove_section' ), |
518 | 518 | 'style' => $iSectionCount <= 1 |
519 | 519 | ? 'display:none' |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | if ( empty( $asArguments ) ) { |
442 | 442 | return ''; |
443 | 443 | } |
444 | - if ( self::hasBeenCalled( 'repeatable_section_' . $sContainerTagID ) ) { |
|
444 | + if ( self::hasBeenCalled( 'repeatable_section_'.$sContainerTagID ) ) { |
|
445 | 445 | return ''; |
446 | 446 | } |
447 | 447 | |
@@ -449,16 +449,16 @@ discard block |
||
449 | 449 | $_oFormatter = new AdminPageFramework_Form_Model___Format_RepeatableSection( $asArguments, $oMsg ); |
450 | 450 | $_aArguments = $_oFormatter->get(); |
451 | 451 | $_sButtons = "<div class='admin-page-framework-repeatable-section-buttons-outer-container'>" |
452 | - . "<div " . self::getAttributes( self::___getContainerAttributes( $_aArguments, $oMsg ) ) . ' ' . self::getDataAttributes( $_aArguments ) . '>' |
|
453 | - . "<a " . self::getAttributes( self::___getRemoveButtonAttributes( $sContainerTagID, $oMsg, $iSectionCount ) ) . ">-</a>" |
|
454 | - . "<a " . self::getAttributes( self::___getAddButtonAttributes( $sContainerTagID, $oMsg, $_aArguments ) ) . ">+</a>" |
|
452 | + . "<div ".self::getAttributes( self::___getContainerAttributes( $_aArguments, $oMsg ) ).' '.self::getDataAttributes( $_aArguments ).'>' |
|
453 | + . "<a ".self::getAttributes( self::___getRemoveButtonAttributes( $sContainerTagID, $oMsg, $iSectionCount ) ).">-</a>" |
|
454 | + . "<a ".self::getAttributes( self::___getAddButtonAttributes( $sContainerTagID, $oMsg, $_aArguments ) ).">+</a>" |
|
455 | 455 | . "</div>" |
456 | 456 | . "</div>" |
457 | 457 | . AdminPageFramework_Form_Utility::getModalForDisabledRepeatableElement( |
458 | - 'repeatable_section_disabled_' . $sContainerTagID, |
|
458 | + 'repeatable_section_disabled_'.$sContainerTagID, |
|
459 | 459 | $_aArguments[ 'disabled' ] |
460 | 460 | ); |
461 | - $_sButtonsHTML = '"' . $_sButtons . '"'; |
|
461 | + $_sButtonsHTML = '"'.$_sButtons.'"'; |
|
462 | 462 | $_aJSArray = json_encode( $_aArguments ); |
463 | 463 | $_sScript = <<<JAVASCRIPTS |
464 | 464 | jQuery( document ).ready( function() { |
@@ -532,10 +532,10 @@ discard block |
||
532 | 532 | . 'repeatable-section-button button button-large', |
533 | 533 | 'title' => $oMsg->get( 'add_section' ), |
534 | 534 | 'data-id' => $sContainerTagID, |
535 | - 'href' => ! empty( $aArguments[ 'disabled' ] ) |
|
536 | - ? '#TB_inline?width=' . $aArguments[ 'disabled' ][ 'box_width' ] |
|
537 | - . '&height=' . $aArguments[ 'disabled' ][ 'box_height' ] |
|
538 | - . '&inlineId=' . 'repeatable_section_disabled_' . $sContainerTagID |
|
535 | + 'href' => !empty( $aArguments[ 'disabled' ] ) |
|
536 | + ? '#TB_inline?width='.$aArguments[ 'disabled' ][ 'box_width' ] |
|
537 | + . '&height='.$aArguments[ 'disabled' ][ 'box_height' ] |
|
538 | + . '&inlineId='.'repeatable_section_disabled_'.$sContainerTagID |
|
539 | 539 | : null, |
540 | 540 | ); |
541 | 541 | } |
@@ -306,18 +306,18 @@ discard block |
||
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
309 | - * Adds form fields. |
|
310 | - * |
|
311 | - * It inserts the given field definition arrays into the class property and later they are parsed when fields are registered. The field definition array requires specific keys. Refer to the parameter section of this method. |
|
312 | - * |
|
313 | - * @since 2.0.0 |
|
314 | - * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
|
315 | - * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
316 | - * @param array the field definition array. |
|
317 | - * @param array (optional) another field array. |
|
318 | - * @param array (optional) add more field arrays to the next parameters as many as necessary. |
|
319 | - * @return void |
|
320 | - */ |
|
309 | + * Adds form fields. |
|
310 | + * |
|
311 | + * It inserts the given field definition arrays into the class property and later they are parsed when fields are registered. The field definition array requires specific keys. Refer to the parameter section of this method. |
|
312 | + * |
|
313 | + * @since 2.0.0 |
|
314 | + * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
|
315 | + * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
316 | + * @param array the field definition array. |
|
317 | + * @param array (optional) another field array. |
|
318 | + * @param array (optional) add more field arrays to the next parameters as many as necessary. |
|
319 | + * @return void |
|
320 | + */ |
|
321 | 321 | public function addSettingFields( /* $aField1, $aField2=null, $_and_more=null */ ) { |
322 | 322 | foreach( func_get_args() as $_aFieldset ) { |
323 | 323 | $this->addSettingField( $_aFieldset ); |
@@ -348,57 +348,57 @@ discard block |
||
348 | 348 | * @return void |
349 | 349 | * @remark The $oForm property should be created in each extended class. |
350 | 350 | * @param array|string $asField A field definition array or a string of the target section id. |
351 | - * <h4>Built-in Field Types</h4> |
|
352 | - * <ul> |
|
353 | - * <li>[text](./class-AdminPageFramework_FieldType_text.html) - a normal field to enter short text input.</li> |
|
354 | - * <li>[password](./class-AdminPageFramework_FieldType_text.html) - a masked text input field.</li> |
|
355 | - * <li>[textarea](./class-AdminPageFramework_FieldType_textarea.html) - a text input field with multiple lines. It supports rich text editors.</li> |
|
356 | - * <li>[radio](./class-AdminPageFramework_FieldType_radio.html) - a set of radio buttons that lets the user pick an option.</li> |
|
357 | - * <li>[checkbox](./class-AdminPageFramework_FieldType_checkbox.html) - a check box that lets the user enable/disable an item.</li> |
|
358 | - * <li>[select](./class-AdminPageFramework_FieldType_select.html) - a drop-down list that lest the user pick one or more item(s) from a list.</li> |
|
359 | - * <li>[hidden](./class-AdminPageFramework_FieldType_hidden.html) - a field with invisible input values.</li> |
|
360 | - * <li>[file](./class-AdminPageFramework_FieldType_file.html) - a file uploader that lets the user upload files.</li> |
|
361 | - * <li>[image](./class-AdminPageFramework_FieldType_image.html) - a text field with an image uploader that lets the user set the image URL.</li> |
|
362 | - * <li>[media](./class-AdminPageFramework_FieldType_media.html) - a text field with a media uploader that lets the user set the file URL.</li> |
|
363 | - * <li>[color](./class-AdminPageFramework_FieldType_color.html) - a text field with a color picker.</li> |
|
364 | - * <li>[submit](./class-AdminPageFramework_FieldType_submit.html) - a submit button that lets the user send the form.</li> |
|
365 | - * <li>[export](./class-AdminPageFramework_FieldType_export.html) - a custom submit field that lets the user export stored data.</li> |
|
366 | - * <li>[import](./class-AdminPageFramework_FieldType_import.html) - a custom combination field of file and submit fields that let the user import data.</li> |
|
367 | - * <li>[posttype](./class-AdminPageFramework_FieldType_posttype.html) - a check-list of post types enabled on the site.</li> |
|
368 | - * <li>[taxonomy](./class-AdminPageFramework_FieldType_taxonomy.html) - a set of check-lists of taxonomies enabled on the site in a tabbed box.</li> |
|
369 | - * <li>[size](./class-AdminPageFramework_FieldType_size.html) - a combination field of the text and the select fields that let the user set sizes with a selectable unit.</li> |
|
370 | - * <li>[section_title](./class-AdminPageFramework_FieldType_section_title.html) - [3.0.0+] a text field type that will be placed in the section title so that it lets the user set the section title. Note that only one field with this field type is allowed per a section.</li> |
|
371 | - * <li>[system](./class-AdminPageFramework_FieldType_system.html) - [3.3.0+] a custom text area field that displays the system information including the PHP settings, the framework version, MySQL version etc.</li> |
|
372 | - * <li>[inline_mixed](./class-AdminPageFramework_FieldType_inline_mixed.html) - [3.8.0+] a field that include inner fields with different field types. </li> |
|
373 | - * </ul> |
|
374 | - * <h4>Field Definition Arguments</h4> |
|
375 | - * <ul> |
|
376 | - * <li>**field_id** - (required, string) the field ID. Avoid using non-alphabetic characters except underscore and numbers.</li> |
|
377 | - * <li>**type** - (optional, string) the type of the field. The supported types are listed below. When creating nested fields, this argument can be omitted.</li> |
|
378 | - * <li>**section_id** - (optional, string) the section ID that the field belongs to. If not set, the internal `_default` section ID will be assigned.</li> |
|
379 | - * <li>**title** - (optional, string) the title of the section.</li> |
|
380 | - * <li>**description** - (optional, string) the description of the field which is inserted into the after the input field tag.</li> |
|
381 | - * <li>**tip** - (optional, string) the tip for the field which is displayed when the mouse is hovered over the field title.</li> |
|
382 | - * <li>**capability** - (optional, string) the <a href="http://codex.wordpress.org/Roles_and_Capabilities">access level</a> of the section. If the page visitor does not have sufficient capability, the section will be invisible to them.</li> |
|
383 | - * <li>**error_message** - (optional, string) the error message to display above the input field.</li> |
|
384 | - * <li>**before_field** - (optional, string) the HTML string to insert before the input field output.</li> |
|
385 | - * <li>**after_field** - (optional, string) the HTML string to insert after the input field output.</li> |
|
386 | - * <li>**if** - (optional, boolean) if the passed value is false, the section will not be registered.</li> |
|
387 | - * <li>**order** - (optional, integer) the order number of the section. The higher the number is, the lower the position it gets.</li> |
|
388 | - * <li>**label** - (optional, string) the text label(s) associated with and displayed along with the input field. Some input types can ignore this key.</li> |
|
389 | - * <li>**default** - (optional, string|array) the default value(s) assigned to the input tag's value attribute.</li> |
|
390 | - * <li>**value** - (optional, string|array) the value(s) assigned to the input tag's `value` attribute to override the default and the stored value.</li> |
|
391 | - * <li>**delimiter** - (optional, string) the HTML string that delimits multiple elements. This is available if the <var>label</var> key is passed as array. It will be enclosed in inline-block elements so the passed HTML string should not contain block elements.</li> |
|
392 | - * <li>**before_input** - (optional, string) the HTML string inserted right before the input tag. It will be enclosed in the <code>label</code> tag so the passed HTML string should not contain block elements.</li> |
|
393 | - * <li>**after_input** - (optional, string) the HTML string inserted right after the input tag. It will be enclosed in the <code>label</code> tag so the passed HTML string should not contain block elements.</li> |
|
394 | - * <li>**label_min_width** - (optional, string) the inline style property of the `min-width` of the label tag for the field. If the unit is not specified, 'px' is applied. Default: `120`. e.g. `100%`</li> |
|
395 | - * <li>**help** - (optional, string) the help description added to the contextual help tab.</li> |
|
396 | - * <li>**help_aside** - (optional, string) the additional help description for the side bar of the contextual help tab.</li> |
|
397 | - * <li>**repeatable** - [3.0.0+] (optional, array|boolean) whether the fields should be repeatable. If it yields true, the plus and the minus buttons appear next to each field that lets the user add/remove the fields. Optionally an setting array can be passed. |
|
398 | - * <h5>Repeatable Fields Setting Array</h5> |
|
399 | - * <ul> |
|
400 | - * <li>**max** - the allowed maximum number of fields to be repeated.</li> |
|
401 | - * <li>**min** - the allowed minimum number of fields to be repeated.</li> |
|
351 | + * <h4>Built-in Field Types</h4> |
|
352 | + * <ul> |
|
353 | + * <li>[text](./class-AdminPageFramework_FieldType_text.html) - a normal field to enter short text input.</li> |
|
354 | + * <li>[password](./class-AdminPageFramework_FieldType_text.html) - a masked text input field.</li> |
|
355 | + * <li>[textarea](./class-AdminPageFramework_FieldType_textarea.html) - a text input field with multiple lines. It supports rich text editors.</li> |
|
356 | + * <li>[radio](./class-AdminPageFramework_FieldType_radio.html) - a set of radio buttons that lets the user pick an option.</li> |
|
357 | + * <li>[checkbox](./class-AdminPageFramework_FieldType_checkbox.html) - a check box that lets the user enable/disable an item.</li> |
|
358 | + * <li>[select](./class-AdminPageFramework_FieldType_select.html) - a drop-down list that lest the user pick one or more item(s) from a list.</li> |
|
359 | + * <li>[hidden](./class-AdminPageFramework_FieldType_hidden.html) - a field with invisible input values.</li> |
|
360 | + * <li>[file](./class-AdminPageFramework_FieldType_file.html) - a file uploader that lets the user upload files.</li> |
|
361 | + * <li>[image](./class-AdminPageFramework_FieldType_image.html) - a text field with an image uploader that lets the user set the image URL.</li> |
|
362 | + * <li>[media](./class-AdminPageFramework_FieldType_media.html) - a text field with a media uploader that lets the user set the file URL.</li> |
|
363 | + * <li>[color](./class-AdminPageFramework_FieldType_color.html) - a text field with a color picker.</li> |
|
364 | + * <li>[submit](./class-AdminPageFramework_FieldType_submit.html) - a submit button that lets the user send the form.</li> |
|
365 | + * <li>[export](./class-AdminPageFramework_FieldType_export.html) - a custom submit field that lets the user export stored data.</li> |
|
366 | + * <li>[import](./class-AdminPageFramework_FieldType_import.html) - a custom combination field of file and submit fields that let the user import data.</li> |
|
367 | + * <li>[posttype](./class-AdminPageFramework_FieldType_posttype.html) - a check-list of post types enabled on the site.</li> |
|
368 | + * <li>[taxonomy](./class-AdminPageFramework_FieldType_taxonomy.html) - a set of check-lists of taxonomies enabled on the site in a tabbed box.</li> |
|
369 | + * <li>[size](./class-AdminPageFramework_FieldType_size.html) - a combination field of the text and the select fields that let the user set sizes with a selectable unit.</li> |
|
370 | + * <li>[section_title](./class-AdminPageFramework_FieldType_section_title.html) - [3.0.0+] a text field type that will be placed in the section title so that it lets the user set the section title. Note that only one field with this field type is allowed per a section.</li> |
|
371 | + * <li>[system](./class-AdminPageFramework_FieldType_system.html) - [3.3.0+] a custom text area field that displays the system information including the PHP settings, the framework version, MySQL version etc.</li> |
|
372 | + * <li>[inline_mixed](./class-AdminPageFramework_FieldType_inline_mixed.html) - [3.8.0+] a field that include inner fields with different field types. </li> |
|
373 | + * </ul> |
|
374 | + * <h4>Field Definition Arguments</h4> |
|
375 | + * <ul> |
|
376 | + * <li>**field_id** - (required, string) the field ID. Avoid using non-alphabetic characters except underscore and numbers.</li> |
|
377 | + * <li>**type** - (optional, string) the type of the field. The supported types are listed below. When creating nested fields, this argument can be omitted.</li> |
|
378 | + * <li>**section_id** - (optional, string) the section ID that the field belongs to. If not set, the internal `_default` section ID will be assigned.</li> |
|
379 | + * <li>**title** - (optional, string) the title of the section.</li> |
|
380 | + * <li>**description** - (optional, string) the description of the field which is inserted into the after the input field tag.</li> |
|
381 | + * <li>**tip** - (optional, string) the tip for the field which is displayed when the mouse is hovered over the field title.</li> |
|
382 | + * <li>**capability** - (optional, string) the <a href="http://codex.wordpress.org/Roles_and_Capabilities">access level</a> of the section. If the page visitor does not have sufficient capability, the section will be invisible to them.</li> |
|
383 | + * <li>**error_message** - (optional, string) the error message to display above the input field.</li> |
|
384 | + * <li>**before_field** - (optional, string) the HTML string to insert before the input field output.</li> |
|
385 | + * <li>**after_field** - (optional, string) the HTML string to insert after the input field output.</li> |
|
386 | + * <li>**if** - (optional, boolean) if the passed value is false, the section will not be registered.</li> |
|
387 | + * <li>**order** - (optional, integer) the order number of the section. The higher the number is, the lower the position it gets.</li> |
|
388 | + * <li>**label** - (optional, string) the text label(s) associated with and displayed along with the input field. Some input types can ignore this key.</li> |
|
389 | + * <li>**default** - (optional, string|array) the default value(s) assigned to the input tag's value attribute.</li> |
|
390 | + * <li>**value** - (optional, string|array) the value(s) assigned to the input tag's `value` attribute to override the default and the stored value.</li> |
|
391 | + * <li>**delimiter** - (optional, string) the HTML string that delimits multiple elements. This is available if the <var>label</var> key is passed as array. It will be enclosed in inline-block elements so the passed HTML string should not contain block elements.</li> |
|
392 | + * <li>**before_input** - (optional, string) the HTML string inserted right before the input tag. It will be enclosed in the <code>label</code> tag so the passed HTML string should not contain block elements.</li> |
|
393 | + * <li>**after_input** - (optional, string) the HTML string inserted right after the input tag. It will be enclosed in the <code>label</code> tag so the passed HTML string should not contain block elements.</li> |
|
394 | + * <li>**label_min_width** - (optional, string) the inline style property of the `min-width` of the label tag for the field. If the unit is not specified, 'px' is applied. Default: `120`. e.g. `100%`</li> |
|
395 | + * <li>**help** - (optional, string) the help description added to the contextual help tab.</li> |
|
396 | + * <li>**help_aside** - (optional, string) the additional help description for the side bar of the contextual help tab.</li> |
|
397 | + * <li>**repeatable** - [3.0.0+] (optional, array|boolean) whether the fields should be repeatable. If it yields true, the plus and the minus buttons appear next to each field that lets the user add/remove the fields. Optionally an setting array can be passed. |
|
398 | + * <h5>Repeatable Fields Setting Array</h5> |
|
399 | + * <ul> |
|
400 | + * <li>**max** - the allowed maximum number of fields to be repeated.</li> |
|
401 | + * <li>**min** - the allowed minimum number of fields to be repeated.</li> |
|
402 | 402 | * <li>**disabled** - (optional, boolean|array) [3.8.13+] |
403 | 403 | * <ul> |
404 | 404 | * <li>**label** - (optional, string) the message to show when the user clicks on the `Add` repeatable button.</li> |
@@ -407,108 +407,108 @@ discard block |
||
407 | 407 | * <li>**box_width** - (optional, integer) the height of the modal window that displays the message. Default: 100.</li> |
408 | 408 | * <ul> |
409 | 409 | * </li> |
410 | - * </ul> |
|
411 | - * </li> |
|
412 | - * <li>**sortable** - [3.0.0+] (optional, boolean) whether the fields should be sortable. If it yields true, the fields will be enclosed in a draggable box. |
|
413 | - * <li>**attributes** - [3.0.0+] (optional, array) holds key-value pairs representing the attribute and its property. Note that some field types have specific keys in the first dimensions. e.g. `array( 'class' => 'my_custom_class_selector', 'style' => 'background-color:#777', 'size' => 20, )` Every field holds the following nested attribute definition arrays. |
|
414 | - * <ul> |
|
415 | - * <li>**fieldrow** - the `td` tag element containing the field output.</li> |
|
416 | - * <li>**fieldset** - the `fieldset` tag element containing the field output.</li> |
|
417 | - * <li>**fields** - the `div` tag element containing the sub-fields and the main field.</li> |
|
418 | - * <li>**field** - the `div` tag element containing each field.</li> |
|
419 | - * </ul> |
|
420 | - * </li> |
|
421 | - * <li>**show_title_column** - [3.0.0+] (optional, boolean) If true, the field title column will be omitted from the output.</li> |
|
422 | - * <li>**hidden** - [3.0.0+] (optional, boolean) If true, the entire field row output will be invisible with the inline style attribute of `style="display:none"`.</li> |
|
423 | - * <li>**save** - [3.6.0+] (optional, boolean) If `false`, the field value will not be saved. Default: `true`</li> |
|
424 | - * <li>**content** - (optional, string|array) [3.6.1+] a custom section output. [3.8.0+] Supports an array to be passed for nested and inline-mixed fields. If an array holding field definitions is set, those fields will be nested. |
|
425 | - * <h4>Example</h4> |
|
426 | - * <pre><code> |
|
427 | - * $this->addSettingFields( |
|
428 | - * 'my_section_id', // the target section ID - pass dimensional keys of the section |
|
429 | - * array( |
|
430 | - * 'field_id' => 'Y', |
|
431 | - * 'title' => __( 'Y', 'admin-page-framework-loader' ), |
|
432 | - * 'description' => __( 'By passing an array of field definition to the <code>content</code> argument, you can nest fields.', 'admin-page-framework-loader' ) |
|
433 | - * . ' ' . __( 'Also the <code>type</code> argument can be omitted.', 'admin-page-framework-loader' ), |
|
434 | - * 'content' => array( |
|
435 | - * array( |
|
436 | - * 'field_id' => 'i', |
|
437 | - * 'title' => __( 'i', 'admin-page-framework-loader' ), |
|
438 | - * 'type' => 'textarea', |
|
439 | - * ), |
|
440 | - * array( |
|
441 | - * 'field_id' => 'ii', |
|
442 | - * 'title' => __( 'ii', 'admin-page-framework-loader' ), |
|
443 | - * 'type' => 'color', |
|
444 | - * ), |
|
445 | - * array( |
|
446 | - * 'field_id' => 'iii', |
|
447 | - * 'title' => __( 'iii', 'admin-page-framework-loader' ), |
|
448 | - * 'repeatable' => true, |
|
449 | - * 'sortable' => true, |
|
450 | - * 'content' => array( |
|
451 | - * array( |
|
452 | - * 'field_id' => 'a', |
|
453 | - * 'title' => __( 'a', 'admin-page-framework-loader' ), |
|
454 | - * 'type' => 'image', |
|
455 | - * 'attributes' => array( |
|
456 | - * 'preview' => array( |
|
457 | - * 'style' => 'max-width: 200px;', |
|
458 | - * ), |
|
459 | - * ), |
|
460 | - * ), |
|
461 | - * array( |
|
462 | - * 'field_id' => 'b', |
|
463 | - * 'title' => __( 'b', 'admin-page-framework-loader' ), |
|
464 | - * 'content' => array( |
|
465 | - * array( |
|
466 | - * 'field_id' => 'first', |
|
467 | - * 'title' => __( '1st', 'admin-page-framework-loader' ), |
|
468 | - * 'type' => 'color', |
|
469 | - * 'repeatable' => true, |
|
470 | - * 'sortable' => true, |
|
471 | - * ), |
|
472 | - * array( |
|
473 | - * 'field_id' => 'second', |
|
474 | - * 'title' => __( '2nd', 'admin-page-framework-loader' ), |
|
475 | - * 'type' => 'size', |
|
476 | - * ), |
|
477 | - * array( |
|
478 | - * 'field_id' => 'third', |
|
479 | - * 'title' => __( '3rd', 'admin-page-framework-loader' ), |
|
480 | - * 'type' => 'select', |
|
481 | - * 'label' => array( |
|
482 | - * 'x' => 'X', |
|
483 | - * 'y' => 'Y', |
|
484 | - * 'z' => 'Z', |
|
485 | - * ), |
|
486 | - * ), |
|
487 | - * ), |
|
488 | - * // 'description' => '', |
|
489 | - * ), |
|
490 | - * array( |
|
491 | - * 'field_id' => 'c', |
|
492 | - * 'title' => __( 'c', 'admin-page-framework-loader' ), |
|
493 | - * 'type' => 'radio', |
|
494 | - * 'label' => array( |
|
495 | - * 'a' => __( 'Apple', 'admin-page-framework-loader' ), |
|
496 | - * 'b' => __( 'Banana', 'admin-page-framework-loader' ), |
|
497 | - * 'c' => __( 'Cherry', 'admin-page-framework-loader' ), |
|
498 | - * ), |
|
499 | - * 'default' => 'b', |
|
500 | - * ), |
|
501 | - * ) |
|
502 | - * ), |
|
503 | - * ), |
|
504 | - * ) |
|
505 | - * ); |
|
506 | - * </code></pre> |
|
507 | - * </li> |
|
508 | - * <li>**placement** - [3.8.0+] (optional, string) Specifies where the field is rendered. Either `normal` `section_title` or `field_title` is accepted. `field_title` can only be used by nested fields defined in the `content` argument. Default: `normal`</li> |
|
509 | - * <li>**show_debug_info** - (optional, boolean) [3.8.8+] Whether to show debug information such as field definition tool-tips. Default: `true`.</li> |
|
510 | - * </ul> |
|
511 | - */ |
|
410 | + * </ul> |
|
411 | + * </li> |
|
412 | + * <li>**sortable** - [3.0.0+] (optional, boolean) whether the fields should be sortable. If it yields true, the fields will be enclosed in a draggable box. |
|
413 | + * <li>**attributes** - [3.0.0+] (optional, array) holds key-value pairs representing the attribute and its property. Note that some field types have specific keys in the first dimensions. e.g. `array( 'class' => 'my_custom_class_selector', 'style' => 'background-color:#777', 'size' => 20, )` Every field holds the following nested attribute definition arrays. |
|
414 | + * <ul> |
|
415 | + * <li>**fieldrow** - the `td` tag element containing the field output.</li> |
|
416 | + * <li>**fieldset** - the `fieldset` tag element containing the field output.</li> |
|
417 | + * <li>**fields** - the `div` tag element containing the sub-fields and the main field.</li> |
|
418 | + * <li>**field** - the `div` tag element containing each field.</li> |
|
419 | + * </ul> |
|
420 | + * </li> |
|
421 | + * <li>**show_title_column** - [3.0.0+] (optional, boolean) If true, the field title column will be omitted from the output.</li> |
|
422 | + * <li>**hidden** - [3.0.0+] (optional, boolean) If true, the entire field row output will be invisible with the inline style attribute of `style="display:none"`.</li> |
|
423 | + * <li>**save** - [3.6.0+] (optional, boolean) If `false`, the field value will not be saved. Default: `true`</li> |
|
424 | + * <li>**content** - (optional, string|array) [3.6.1+] a custom section output. [3.8.0+] Supports an array to be passed for nested and inline-mixed fields. If an array holding field definitions is set, those fields will be nested. |
|
425 | + * <h4>Example</h4> |
|
426 | + * <pre><code> |
|
427 | + * $this->addSettingFields( |
|
428 | + * 'my_section_id', // the target section ID - pass dimensional keys of the section |
|
429 | + * array( |
|
430 | + * 'field_id' => 'Y', |
|
431 | + * 'title' => __( 'Y', 'admin-page-framework-loader' ), |
|
432 | + * 'description' => __( 'By passing an array of field definition to the <code>content</code> argument, you can nest fields.', 'admin-page-framework-loader' ) |
|
433 | + * . ' ' . __( 'Also the <code>type</code> argument can be omitted.', 'admin-page-framework-loader' ), |
|
434 | + * 'content' => array( |
|
435 | + * array( |
|
436 | + * 'field_id' => 'i', |
|
437 | + * 'title' => __( 'i', 'admin-page-framework-loader' ), |
|
438 | + * 'type' => 'textarea', |
|
439 | + * ), |
|
440 | + * array( |
|
441 | + * 'field_id' => 'ii', |
|
442 | + * 'title' => __( 'ii', 'admin-page-framework-loader' ), |
|
443 | + * 'type' => 'color', |
|
444 | + * ), |
|
445 | + * array( |
|
446 | + * 'field_id' => 'iii', |
|
447 | + * 'title' => __( 'iii', 'admin-page-framework-loader' ), |
|
448 | + * 'repeatable' => true, |
|
449 | + * 'sortable' => true, |
|
450 | + * 'content' => array( |
|
451 | + * array( |
|
452 | + * 'field_id' => 'a', |
|
453 | + * 'title' => __( 'a', 'admin-page-framework-loader' ), |
|
454 | + * 'type' => 'image', |
|
455 | + * 'attributes' => array( |
|
456 | + * 'preview' => array( |
|
457 | + * 'style' => 'max-width: 200px;', |
|
458 | + * ), |
|
459 | + * ), |
|
460 | + * ), |
|
461 | + * array( |
|
462 | + * 'field_id' => 'b', |
|
463 | + * 'title' => __( 'b', 'admin-page-framework-loader' ), |
|
464 | + * 'content' => array( |
|
465 | + * array( |
|
466 | + * 'field_id' => 'first', |
|
467 | + * 'title' => __( '1st', 'admin-page-framework-loader' ), |
|
468 | + * 'type' => 'color', |
|
469 | + * 'repeatable' => true, |
|
470 | + * 'sortable' => true, |
|
471 | + * ), |
|
472 | + * array( |
|
473 | + * 'field_id' => 'second', |
|
474 | + * 'title' => __( '2nd', 'admin-page-framework-loader' ), |
|
475 | + * 'type' => 'size', |
|
476 | + * ), |
|
477 | + * array( |
|
478 | + * 'field_id' => 'third', |
|
479 | + * 'title' => __( '3rd', 'admin-page-framework-loader' ), |
|
480 | + * 'type' => 'select', |
|
481 | + * 'label' => array( |
|
482 | + * 'x' => 'X', |
|
483 | + * 'y' => 'Y', |
|
484 | + * 'z' => 'Z', |
|
485 | + * ), |
|
486 | + * ), |
|
487 | + * ), |
|
488 | + * // 'description' => '', |
|
489 | + * ), |
|
490 | + * array( |
|
491 | + * 'field_id' => 'c', |
|
492 | + * 'title' => __( 'c', 'admin-page-framework-loader' ), |
|
493 | + * 'type' => 'radio', |
|
494 | + * 'label' => array( |
|
495 | + * 'a' => __( 'Apple', 'admin-page-framework-loader' ), |
|
496 | + * 'b' => __( 'Banana', 'admin-page-framework-loader' ), |
|
497 | + * 'c' => __( 'Cherry', 'admin-page-framework-loader' ), |
|
498 | + * ), |
|
499 | + * 'default' => 'b', |
|
500 | + * ), |
|
501 | + * ) |
|
502 | + * ), |
|
503 | + * ), |
|
504 | + * ) |
|
505 | + * ); |
|
506 | + * </code></pre> |
|
507 | + * </li> |
|
508 | + * <li>**placement** - [3.8.0+] (optional, string) Specifies where the field is rendered. Either `normal` `section_title` or `field_title` is accepted. `field_title` can only be used by nested fields defined in the `content` argument. Default: `normal`</li> |
|
509 | + * <li>**show_debug_info** - (optional, boolean) [3.8.8+] Whether to show debug information such as field definition tool-tips. Default: `true`.</li> |
|
510 | + * </ul> |
|
511 | + */ |
|
512 | 512 | public function addSettingField( $asFieldset ) { |
513 | 513 | if ( method_exists( $this->oForm, 'addField' ) ) { |
514 | 514 | $this->oForm->addField( $asFieldset ); |
@@ -572,28 +572,28 @@ discard block |
||
572 | 572 | } |
573 | 573 | |
574 | 574 | /** |
575 | - * Sets the given message to be displayed in the next page load. |
|
576 | - * |
|
577 | - * This is used to inform users about the submitted input data, such as "Updated successfully." or "Problem occurred." etc. |
|
578 | - * and normally used in validation callback methods. |
|
579 | - * |
|
580 | - * <h4>Example</h4> |
|
581 | - * ` |
|
582 | - * if ( ! $bVerified ) { |
|
583 | - * $this->setFieldErrors( $aErrors ); |
|
584 | - * $this->setSettingNotice( 'There was an error in your input.' ); |
|
585 | - * return $aOldPageOptions; |
|
586 | - * } |
|
587 | - * ` |
|
588 | - * |
|
589 | - * @since 3.0.4 |
|
590 | - * @access public |
|
591 | - * @param string $sMessage the text message to be displayed. |
|
592 | - * @param string $sType (optional) the type of the message, either "error" or "updated" is used. |
|
593 | - * @param array $asAttributes (optional) the tag attribute array applied to the message container HTML element. If a string is given, it is used as the ID attribute value. |
|
594 | - * @param boolean $bOverride (optional) If true, only one message will be shown in the next page load. false: do not override when there is a message of the same id. true: override the previous one. |
|
595 | - * @return void |
|
596 | - */ |
|
575 | + * Sets the given message to be displayed in the next page load. |
|
576 | + * |
|
577 | + * This is used to inform users about the submitted input data, such as "Updated successfully." or "Problem occurred." etc. |
|
578 | + * and normally used in validation callback methods. |
|
579 | + * |
|
580 | + * <h4>Example</h4> |
|
581 | + * ` |
|
582 | + * if ( ! $bVerified ) { |
|
583 | + * $this->setFieldErrors( $aErrors ); |
|
584 | + * $this->setSettingNotice( 'There was an error in your input.' ); |
|
585 | + * return $aOldPageOptions; |
|
586 | + * } |
|
587 | + * ` |
|
588 | + * |
|
589 | + * @since 3.0.4 |
|
590 | + * @access public |
|
591 | + * @param string $sMessage the text message to be displayed. |
|
592 | + * @param string $sType (optional) the type of the message, either "error" or "updated" is used. |
|
593 | + * @param array $asAttributes (optional) the tag attribute array applied to the message container HTML element. If a string is given, it is used as the ID attribute value. |
|
594 | + * @param boolean $bOverride (optional) If true, only one message will be shown in the next page load. false: do not override when there is a message of the same id. true: override the previous one. |
|
595 | + * @return void |
|
596 | + */ |
|
597 | 597 | public function setSettingNotice( $sMessage, $sType='error', $asAttributes=array(), $bOverride=true ) { |
598 | 598 | $this->oForm->setSubmitNotice( |
599 | 599 | $sMessage, |