@@ -66,6 +66,9 @@ |
||
| 66 | 66 | self::addFilters('feature', $name, $filePath); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | + /** |
|
| 70 | + * @param string $category |
|
| 71 | + */ |
|
| 69 | 72 | public static function addFilters($category, $name, $filePath) |
| 70 | 73 | { |
| 71 | 74 | if (false === $filePath || !file_exists($filePath)) { |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | $filterNamespace = self::FILTER_NAMESPACES[$category]; |
| 80 | 80 | $filterName = "{$filterNamespace}/{$name}/Fields/{$groupKey}"; |
| 81 | 81 | |
| 82 | - add_filter($filterName, function ($config) use ($groupValue) { |
|
| 82 | + add_filter($filterName, function($config) use ($groupValue) { |
|
| 83 | 83 | return $groupValue; |
| 84 | 84 | }); |
| 85 | 85 | if (ArrayHelpers::isAssoc($groupValue) && array_key_exists('sub_fields', $groupValue)) { |
| 86 | 86 | $filterName .= '/SubFields'; |
| 87 | 87 | $subFields = $groupValue['sub_fields']; |
| 88 | 88 | |
| 89 | - add_filter($filterName, function ($subFieldsconfig) use ($subFields) { |
|
| 89 | + add_filter($filterName, function($subFieldsconfig) use ($subFields) { |
|
| 90 | 90 | return $subFields; |
| 91 | 91 | }); |
| 92 | 92 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $subFieldName = ucfirst($subField['name']); |
| 111 | 111 | $subFilterName = $parentFilterName . "/{$subFieldName}"; |
| 112 | 112 | |
| 113 | - add_filter($subFilterName, function ($subFieldConfig) use ($subField) { |
|
| 113 | + add_filter($subFilterName, function($subFieldConfig) use ($subField) { |
|
| 114 | 114 | return $subField; |
| 115 | 115 | }); |
| 116 | 116 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 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(); |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | // find and replace relevant keys, then return an array of all options for this Sub-Page |
| 131 | 131 | $optionKeys = is_array($options) ? array_keys($options) : []; |
| 132 | - $options = array_reduce($optionKeys, function ($carry, $key) use ($options, $prefix) { |
|
| 132 | + $options = array_reduce($optionKeys, function($carry, $key) use ($options, $prefix) { |
|
| 133 | 133 | $count = 0; |
| 134 | 134 | $option = $options[$key]; |
| 135 | 135 | $key = str_replace($prefix, '', $key, $count); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | public static function addComponentData($data, $parentData, $config) |
| 154 | 154 | { |
| 155 | 155 | // get fields for this component |
| 156 | - $options = array_reduce(array_keys(self::$optionTypes), function ($carry, $optionType) use ($config) { |
|
| 156 | + $options = array_reduce(array_keys(self::$optionTypes), function($carry, $optionType) use ($config) { |
|
| 157 | 157 | return array_merge($carry, self::get($optionType, 'Component', $config['name'])); |
| 158 | 158 | }, []); |
| 159 | 159 | |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | ]; |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - add_action('current_screen', function ($currentScreen) { |
|
| 224 | + add_action('current_screen', function($currentScreen) { |
|
| 225 | 225 | foreach (self::$optionTypes as $optionType => $option) { |
| 226 | 226 | $isTranslatable = $option['translatable']; |
| 227 | 227 | $toplevelPageId = 'toplevel_page_' . $optionType; |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | add_filter('acf/settings/current_language', 'Flynt\Features\Acf\OptionPages::getDefaultAcfLanguage', 101); |
| 236 | 236 | |
| 237 | 237 | // hide language selector in admin bar |
| 238 | - add_action('wp_before_admin_bar_render', function () { |
|
| 238 | + add_action('wp_before_admin_bar_render', function() { |
|
| 239 | 239 | $adminBar = $GLOBALS['wp_admin_bar']; |
| 240 | 240 | $adminBar->remove_menu('WPML_ALS'); |
| 241 | 241 | }); |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | protected static function prefixFields($fields, $prefix) |
| 334 | 334 | { |
| 335 | - return array_map(function ($field) use ($prefix) { |
|
| 335 | + return array_map(function($field) use ($prefix) { |
|
| 336 | 336 | $field['name'] = $prefix . '_' . $field['name']; |
| 337 | 337 | return $field; |
| 338 | 338 | }, $fields); |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | |
| 384 | 384 | protected static function combineArrayDefaults(array $array, array $defaults) |
| 385 | 385 | { |
| 386 | - return array_map(function ($value) use ($defaults) { |
|
| 386 | + return array_map(function($value) use ($defaults) { |
|
| 387 | 387 | return is_array($value) ? array_merge($defaults, $value) : []; |
| 388 | 388 | }, $array); |
| 389 | 389 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | * in order to make sure custom post types are registered before acf fields |
| 14 | 14 | * (e.g. for option pages) are added the priority needs to be lower that 5 |
| 15 | 15 | */ |
| 16 | -add_action('init', function () { |
|
| 16 | +add_action('init', function() { |
|
| 17 | 17 | $featureOptions = Feature::getOption('flynt-custom-post-types', 0); |
| 18 | 18 | $dir = isset($featureOptions['dir']) ? $featureOptions['dir'] : null; |
| 19 | 19 | $fileName = isset($featureOptions['fileName']) ? $featureOptions['fileName'] : null; |