Completed
Pull Request — master (#229)
by Doğa
06:39 queued 03:17
created
Features/Acf/OptionPages.php 2 patches
Doc Comments   +23 added lines patch added patch discarded remove patch
@@ -240,6 +240,9 @@  discard block
 block discarded – undo
240 240
         });
241 241
     }
242 242
 
243
+    /**
244
+     * @param string $type
245
+     */
243 246
     protected static function createSubPage($type, $name)
244 247
     {
245 248
         $namespace = self::FILTER_NAMESPACES[$type];
@@ -257,6 +260,9 @@  discard block
 block discarded – undo
257 260
         }
258 261
     }
259 262
 
263
+    /**
264
+     * @param string $subPageName
265
+     */
260 266
     protected static function addOptionSubPage($optionCategoryName, $subPageName, $optionType, $fields)
261 267
     {
262 268
         $prettySubPageName = StringHelpers::splitCamelCase($subPageName);
@@ -285,6 +291,9 @@  discard block
 block discarded – undo
285 291
         );
286 292
     }
287 293
 
294
+    /**
295
+     * @param string $menuSlug
296
+     */
288 297
     protected static function addFieldGroupToSubPage($parentMenuSlug, $menuSlug, $prettySubPageName, $fields)
289 298
     {
290 299
         $fieldGroup = ACFComposer\ResolveConfig::forFieldGroup(
@@ -308,6 +317,10 @@  discard block
 block discarded – undo
308 317
         acf_add_local_field_group($fieldGroup);
309 318
     }
310 319
 
320
+    /**
321
+     * @param string $optionCategory
322
+     * @param string $feature
323
+     */
311 324
     protected static function checkFeature($optionCategory, $feature)
312 325
     {
313 326
         if (array_key_exists($optionCategory, self::$optionCategories) && !Feature::isRegistered($feature)) {
@@ -334,6 +347,12 @@  discard block
 block discarded – undo
334 347
         }, $fields);
335 348
     }
336 349
 
350
+    /**
351
+     * @param string $optionType
352
+     * @param string $optionCategory
353
+     * @param string $subPageName
354
+     * @param string|null $fieldName
355
+     */
337 356
     protected static function checkRequiredHooks($optionType, $optionCategory, $subPageName, $fieldName)
338 357
     {
339 358
         if (did_action('acf/init') < 1) {
@@ -389,6 +408,10 @@  discard block
 block discarded – undo
389 408
     }
390 409
 
391 410
     // find and replace relevant keys, then return an array of all options for this Sub-Page
411
+
412
+    /**
413
+     * @param string $prefix
414
+     */
392 415
     protected static function collectOptionsWithPrefix($options, $prefix)
393 416
     {
394 417
         $optionKeys = is_array($options) ? array_keys($options) : [];
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         self::createOptionPages();
72 72
 
73 73
         // Register Categories
74
-        add_action('acf/init', function () {
74
+        add_action('acf/init', function() {
75 75
             self::addComponentSubPages();
76 76
             self::addFeatureSubPages();
77 77
             self::addCustomPostTypeSubPages();
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
     public static function addComponentData($data, $parentData, $config)
150 150
     {
151 151
         // get fields for this component
152
-        $options = array_reduce(array_keys(self::$optionTypes), function ($carry, $optionType) use ($config) {
152
+        $options = array_reduce(array_keys(self::$optionTypes), function($carry, $optionType) use ($config) {
153 153
             return array_merge($carry, self::get($optionType, 'Component', $config['name']));
154 154
         }, []);
155 155
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
             ];
218 218
         }
219 219
 
220
-        add_action('current_screen', function ($currentScreen) {
220
+        add_action('current_screen', function($currentScreen) {
221 221
             foreach (self::$optionTypes as $optionType => $option) {
222 222
                 $isTranslatable = $option['translatable'];
223 223
                 $toplevelPageId = 'toplevel_page_' . $optionType;
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
                     add_filter('acf/settings/current_language', 'Flynt\Features\Acf\OptionPages::getDefaultAcfLanguage', 101);
232 232
 
233 233
                     // hide language selector in admin bar
234
-                    add_action('wp_before_admin_bar_render', function () {
234
+                    add_action('wp_before_admin_bar_render', function() {
235 235
                         $adminBar = $GLOBALS['wp_admin_bar'];
236 236
                         $adminBar->remove_menu('WPML_ALS');
237 237
                     });
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 
329 329
     protected static function prefixFields($fields, $prefix)
330 330
     {
331
-        return array_map(function ($field) use ($prefix) {
331
+        return array_map(function($field) use ($prefix) {
332 332
             $field['name'] = $prefix . '_' . $field['name'];
333 333
             return $field;
334 334
         }, $fields);
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
     protected static function collectOptionsWithPrefix($options, $prefix)
393 393
     {
394 394
         $optionKeys = is_array($options) ? array_keys($options) : [];
395
-        return array_reduce($optionKeys, function ($carry, $key) use ($options, $prefix) {
395
+        return array_reduce($optionKeys, function($carry, $key) use ($options, $prefix) {
396 396
             $count = 0;
397 397
             $option = $options[$key];
398 398
             $key = str_replace($prefix, '', $key, $count);
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 
406 406
     protected static function combineArrayDefaults(array $array, array $defaults)
407 407
     {
408
-        return array_map(function ($value) use ($defaults) {
408
+        return array_map(function($value) use ($defaults) {
409 409
             return is_array($value) ? array_merge($defaults, $value) : [];
410 410
         }, $array);
411 411
     }
Please login to merge, or discard this patch.