@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | if (is_admin()) { |
| 39 | 39 | add_action('admin_enqueue_scripts', NS . 'enqueueComponentScripts'); |
| 40 | 40 | // add image to the flexible content component name |
| 41 | - add_filter('acf/fields/flexible_content/layout_title', function ($title, $field, $layout, $i) { |
|
| 41 | + add_filter('acf/fields/flexible_content/layout_title', function($title, $field, $layout, $i) { |
|
| 42 | 42 | $componentName = ucfirst($layout['name']); |
| 43 | 43 | $componentPath = "Components/{$componentName}"; |
| 44 | - $componentPreviewDesktopPath = Asset::requirePath("{$componentPath}/preview-desktop.jpg") ; |
|
| 44 | + $componentPreviewDesktopPath = Asset::requirePath("{$componentPath}/preview-desktop.jpg"); |
|
| 45 | 45 | $componentPreviewDesktopUrl = Asset::requireUrl("{$componentPath}/preview-desktop.jpg"); |
| 46 | 46 | if (is_file($componentPreviewDesktopPath)) { |
| 47 | 47 | $newTitle = '<span class="flyntComponentPreview">'; |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | } else { |
| 56 | 56 | add_action('wp_enqueue_scripts', NS . 'enqueueComponentScripts'); |
| 57 | 57 | // adds Component Previews button to admin bar on front-end when logged in |
| 58 | - add_action('admin_bar_menu', function ($wpAdminBar) { |
|
| 58 | + add_action('admin_bar_menu', function($wpAdminBar) { |
|
| 59 | 59 | $title = __('Component Previews', 'flynt-starter-theme'); |
| 60 | 60 | $wpAdminBar->add_menu([ |
| 61 | 61 | 'id' => 'toggleComponentPreviews', |
@@ -12,10 +12,10 @@ discard block |
||
| 12 | 12 | // register all components |
| 13 | 13 | $componentPath = trailingslashit(Feature::getOption('flynt-components', 0)); |
| 14 | 14 | |
| 15 | -add_action('Flynt/afterRegisterFeatures', function () use ($componentPath) { |
|
| 15 | +add_action('Flynt/afterRegisterFeatures', function() use ($componentPath) { |
|
| 16 | 16 | if (is_dir($componentPath)) { |
| 17 | 17 | $components = []; |
| 18 | - FileLoader::iterateDir($componentPath, function ($dir) use (&$components) { |
|
| 18 | + FileLoader::iterateDir($componentPath, function($dir) use (&$components) { |
|
| 19 | 19 | if ($dir->isDir()) { |
| 20 | 20 | $components[] = $dir->getFilename(); |
| 21 | 21 | } |
@@ -26,6 +26,6 @@ discard block |
||
| 26 | 26 | }); |
| 27 | 27 | |
| 28 | 28 | // set Component Path |
| 29 | -add_filter('Flynt/componentPath', function ($defaultPath, $componentName) use ($componentPath) { |
|
| 29 | +add_filter('Flynt/componentPath', function($defaultPath, $componentName) use ($componentPath) { |
|
| 30 | 30 | return $componentPath . $componentName; |
| 31 | 31 | }, 10, 2); |
@@ -270,6 +270,9 @@ discard block |
||
| 270 | 270 | }); |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | + /** |
|
| 274 | + * @param string $optionCategoryName |
|
| 275 | + */ |
|
| 273 | 276 | protected static function createSubPageFromConfig($filePath, $optionCategoryName, $subPageName) |
| 274 | 277 | { |
| 275 | 278 | $fields = json_decode(file_get_contents($filePath), true); |
@@ -286,6 +289,9 @@ discard block |
||
| 286 | 289 | } |
| 287 | 290 | } |
| 288 | 291 | |
| 292 | + /** |
|
| 293 | + * @param string $subPageName |
|
| 294 | + */ |
|
| 289 | 295 | protected static function addOptionSubPage($optionCategoryName, $subPageName, $optionType, $fields) |
| 290 | 296 | { |
| 291 | 297 | $prettySubPageName = StringHelpers::splitCamelCase($subPageName); |
@@ -314,6 +320,9 @@ discard block |
||
| 314 | 320 | ); |
| 315 | 321 | } |
| 316 | 322 | |
| 323 | + /** |
|
| 324 | + * @param string $menuSlug |
|
| 325 | + */ |
|
| 317 | 326 | protected static function addFieldGroupToSubPage($parentMenuSlug, $menuSlug, $prettySubPageName, $fields) |
| 318 | 327 | { |
| 319 | 328 | $fieldGroup = ACFComposer\ResolveConfig::forFieldGroup( |
@@ -337,6 +346,10 @@ discard block |
||
| 337 | 346 | acf_add_local_field_group($fieldGroup); |
| 338 | 347 | } |
| 339 | 348 | |
| 349 | + /** |
|
| 350 | + * @param string $optionCategory |
|
| 351 | + * @param string $feature |
|
| 352 | + */ |
|
| 340 | 353 | protected static function checkFeature($optionCategory, $feature) |
| 341 | 354 | { |
| 342 | 355 | if (array_key_exists($optionCategory, self::$optionCategories) && !Feature::isRegistered($feature)) { |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | // find and replace relevant keys, then return an array of all options for this Sub-Page |
| 117 | 117 | $optionKeys = is_array($options) ? array_keys($options) : []; |
| 118 | - $options = array_reduce($optionKeys, function ($carry, $key) use ($options, $prefix) { |
|
| 118 | + $options = array_reduce($optionKeys, function($carry, $key) use ($options, $prefix) { |
|
| 119 | 119 | $count = 0; |
| 120 | 120 | $option = $options[$key]; |
| 121 | 121 | $key = str_replace($prefix, '', $key, $count); |
@@ -144,10 +144,10 @@ discard block |
||
| 144 | 144 | 12 |
| 145 | 145 | ); |
| 146 | 146 | |
| 147 | - add_filter('Flynt/addComponentData', function ($data, $parentData, $config) { |
|
| 147 | + add_filter('Flynt/addComponentData', function($data, $parentData, $config) { |
|
| 148 | 148 | |
| 149 | 149 | // get fields for this component |
| 150 | - $options = array_reduce(array_keys(self::$optionTypes), function ($carry, $optionType) use ($config) { |
|
| 150 | + $options = array_reduce(array_keys(self::$optionTypes), function($carry, $optionType) use ($config) { |
|
| 151 | 151 | return array_merge($carry, self::get($optionType, 'Component', $config['name'])); |
| 152 | 152 | }, []); |
| 153 | 153 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | ]; |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - add_action('current_screen', function ($currentScreen) { |
|
| 250 | + add_action('current_screen', function($currentScreen) { |
|
| 251 | 251 | foreach (self::$optionTypes as $optionType => $option) { |
| 252 | 252 | $isTranslatable = $option['translatable']; |
| 253 | 253 | $toplevelPageId = 'toplevel_page_' . $optionType; |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | add_filter('acf/settings/current_language', 'Flynt\Features\Acf\OptionPages::getDefaultAcfLanguage', 101); |
| 262 | 262 | |
| 263 | 263 | // hide language selector in admin bar |
| 264 | - add_action('wp_before_admin_bar_render', function () { |
|
| 264 | + add_action('wp_before_admin_bar_render', function() { |
|
| 265 | 265 | $adminBar = $GLOBALS['wp_admin_bar']; |
| 266 | 266 | $adminBar->remove_menu('WPML_ALS'); |
| 267 | 267 | }); |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | |
| 358 | 358 | protected static function prefixFields($fields, $prefix) |
| 359 | 359 | { |
| 360 | - return array_map(function ($field) use ($prefix) { |
|
| 360 | + return array_map(function($field) use ($prefix) { |
|
| 361 | 361 | $field['name'] = $prefix . '_' . $field['name']; |
| 362 | 362 | return $field; |
| 363 | 363 | }, $fields); |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | |
| 409 | 409 | protected static function combineArrayDefaults(array $array, array $defaults) |
| 410 | 410 | { |
| 411 | - return array_map(function ($value) use ($defaults) { |
|
| 411 | + return array_map(function($value) use ($defaults) { |
|
| 412 | 412 | return is_array($value) ? array_merge($defaults, $value) : []; |
| 413 | 413 | }, $array); |
| 414 | 414 | } |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | { |
| 7 | 7 | public static function init() |
| 8 | 8 | { |
| 9 | - add_filter('acf/fields/google_map/api', function ($api) { |
|
| 9 | + add_filter('acf/fields/google_map/api', function($api) { |
|
| 10 | 10 | $apiKey = OptionPages::get('globalOptions', 'feature', 'Acf', 'googleMapsApiKey'); |
| 11 | 11 | if ($apiKey) { |
| 12 | 12 | $api['key'] = $apiKey; |
@@ -5,11 +5,11 @@ |
||
| 5 | 5 | use Flynt\Features\Components\Component; |
| 6 | 6 | use Timber\Menu; |
| 7 | 7 | |
| 8 | -add_action('wp_enqueue_scripts', function () { |
|
| 8 | +add_action('wp_enqueue_scripts', function() { |
|
| 9 | 9 | Component::enqueueAssets('NavigationMain'); |
| 10 | 10 | }); |
| 11 | 11 | |
| 12 | -add_filter('Flynt/addComponentData?name=NavigationMain', function ($data) { |
|
| 12 | +add_filter('Flynt/addComponentData?name=NavigationMain', function($data) { |
|
| 13 | 13 | // set max level of the menu |
| 14 | 14 | $data['maxLevel'] = 0; |
| 15 | 15 | $data['menuSlug'] = !empty($data['menuSlug']) ? $data['menuSlug'] : ''; |
@@ -4,11 +4,11 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Flynt\Features\Components\Component; |
| 6 | 6 | |
| 7 | -add_action('wp_enqueue_scripts', function () { |
|
| 7 | +add_action('wp_enqueue_scripts', function() { |
|
| 8 | 8 | Component::enqueueAssets('ListPosts'); |
| 9 | 9 | }); |
| 10 | 10 | |
| 11 | -add_filter('Flynt/addComponentData?name=ListPosts', function ($data, $parentData) { |
|
| 11 | +add_filter('Flynt/addComponentData?name=ListPosts', function($data, $parentData) { |
|
| 12 | 12 | $data['isArchive'] = is_home() || is_archive(); |
| 13 | 13 | |
| 14 | 14 | $data['pagination'] = (isset($parentData['pagination'])) ? $parentData['pagination'] : null; |
@@ -5,11 +5,11 @@ |
||
| 5 | 5 | use Flynt\Features\Components\Component; |
| 6 | 6 | use Flynt\Utils\Oembed; |
| 7 | 7 | |
| 8 | -add_action('wp_enqueue_scripts', function () { |
|
| 8 | +add_action('wp_enqueue_scripts', function() { |
|
| 9 | 9 | Component::enqueueAssets('BlockMediaText'); |
| 10 | 10 | }); |
| 11 | 11 | |
| 12 | -add_filter('Flynt/addComponentData?name=BlockMediaText', function ($data) { |
|
| 12 | +add_filter('Flynt/addComponentData?name=BlockMediaText', function($data) { |
|
| 13 | 13 | if ($data['mediaType'] === 'oembedVideo') { |
| 14 | 14 | $data['oembedLazyLoad'] = Oembed::setSrcAsDataAttribute( |
| 15 | 15 | $data['oembed'], |
@@ -5,8 +5,8 @@ discard block |
||
| 5 | 5 | use Flynt\Features\Components\Component; |
| 6 | 6 | use Flynt\Utils\Oembed; |
| 7 | 7 | |
| 8 | -add_filter('Flynt/addComponentData?name=SliderMedia', function ($data) { |
|
| 9 | - $data['mediaSlides'] = array_map(function ($item) { |
|
| 8 | +add_filter('Flynt/addComponentData?name=SliderMedia', function($data) { |
|
| 9 | + $data['mediaSlides'] = array_map(function($item) { |
|
| 10 | 10 | if ($item['mediaType'] == 'oembed') { |
| 11 | 11 | $item['oembedLazyLoad'] = Oembed::setSrcAsDataAttribute( |
| 12 | 12 | $item['oembed'], |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | return $data; |
| 22 | 22 | }); |
| 23 | 23 | |
| 24 | -add_action('wp_enqueue_scripts', function () { |
|
| 24 | +add_action('wp_enqueue_scripts', function() { |
|
| 25 | 25 | Component::enqueueAssets('SliderMedia', [ |
| 26 | 26 | [ |
| 27 | 27 | 'name' => 'slick-carousel', |
@@ -5,11 +5,11 @@ |
||
| 5 | 5 | use Flynt\Features\Components\Component; |
| 6 | 6 | use Flynt\Utils\Oembed; |
| 7 | 7 | |
| 8 | -add_action('wp_enqueue_scripts', function () { |
|
| 8 | +add_action('wp_enqueue_scripts', function() { |
|
| 9 | 9 | Component::enqueueAssets('BlockVideoOembed'); |
| 10 | 10 | }); |
| 11 | 11 | |
| 12 | -add_filter('Flynt/addComponentData?name=BlockVideoOembed', function ($data) { |
|
| 12 | +add_filter('Flynt/addComponentData?name=BlockVideoOembed', function($data) { |
|
| 13 | 13 | $data['oembedLazyLoad'] = Oembed::setSrcAsDataAttribute( |
| 14 | 14 | $data['oembed'], |
| 15 | 15 | [ |