@@ -6,24 +6,24 @@ discard block |
||
6 | 6 | use Flynt\Features\Components\Component; |
7 | 7 | use Flynt\Utils\Asset; |
8 | 8 | |
9 | -add_filter('Flynt/addComponentData?name=ListComponents', function ($data) { |
|
10 | - add_action('wp_enqueue_scripts', function () { |
|
9 | +add_filter('Flynt/addComponentData?name=ListComponents', function($data) { |
|
10 | + add_action('wp_enqueue_scripts', function() { |
|
11 | 11 | Component::enqueueAssets('ListComponents'); |
12 | 12 | }); |
13 | 13 | |
14 | 14 | if (!empty($data['componentBlocks'])) { |
15 | - $data['componentBlocks'] = array_map(function ($block) { |
|
15 | + $data['componentBlocks'] = array_map(function($block) { |
|
16 | 16 | $componentPaths = explode('/', $block['component']); |
17 | - $block['component'] = implode('/', array_slice($componentPaths, count($componentPaths)-3, 3)); |
|
17 | + $block['component'] = implode('/', array_slice($componentPaths, count($componentPaths) - 3, 3)); |
|
18 | 18 | |
19 | - if (file_exists(Asset::requirePath($block['component']."preview-desktop.jpg"))) { |
|
20 | - $block['componentPreviewDesktopUrl'] = Asset::requireUrl($block['component']."preview-desktop.jpg"); |
|
19 | + if (file_exists(Asset::requirePath($block['component'] . "preview-desktop.jpg"))) { |
|
20 | + $block['componentPreviewDesktopUrl'] = Asset::requireUrl($block['component'] . "preview-desktop.jpg"); |
|
21 | 21 | } |
22 | 22 | |
23 | - if (file_exists(Asset::requirePath($block['component']."preview-mobile.jpg"))) { |
|
24 | - $block['componentPreviewMobileUrl'] = Asset::requireUrl($block['component']."preview-mobile.jpg"); |
|
23 | + if (file_exists(Asset::requirePath($block['component'] . "preview-mobile.jpg"))) { |
|
24 | + $block['componentPreviewMobileUrl'] = Asset::requireUrl($block['component'] . "preview-mobile.jpg"); |
|
25 | 25 | } |
26 | - $readme = Asset::requirePath($block['component']."README.md"); |
|
26 | + $readme = Asset::requirePath($block['component'] . "README.md"); |
|
27 | 27 | |
28 | 28 | if (file_exists($readme)) { |
29 | 29 | $block['readme'] = parsePreviewContent(file_get_contents($readme)); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | }); |
38 | 38 | |
39 | 39 | |
40 | -add_filter('acf/load_field/name=component', function ($field) { |
|
40 | +add_filter('acf/load_field/name=component', function($field) { |
|
41 | 41 | $componentManager = ComponentManager::getInstance(); |
42 | 42 | $field['choices'] = array_flip($componentManager->getAll()); |
43 | 43 | return $field; |
@@ -7,19 +7,19 @@ discard block |
||
7 | 7 | use Timber\Menu; |
8 | 8 | use Flynt\Features\Acf\OptionPages; |
9 | 9 | |
10 | -add_action('wp_enqueue_scripts', function () { |
|
10 | +add_action('wp_enqueue_scripts', function() { |
|
11 | 11 | Component::enqueueAssets('NavigationMain'); |
12 | 12 | }); |
13 | 13 | |
14 | -add_filter('Flynt/addComponentData?name=NavigationMain', function ($data) { |
|
14 | +add_filter('Flynt/addComponentData?name=NavigationMain', function($data) { |
|
15 | 15 | // set max level of the menu |
16 | 16 | $data['maxLevel'] = 0; |
17 | 17 | $data['menuSlug'] = !empty($data['menuSlug']) ? $data['menuSlug'] : ''; |
18 | 18 | $data['menu'] = has_nav_menu($data['menuSlug']) ? new Menu($data['menuSlug']) : false; |
19 | 19 | |
20 | 20 | if (!empty($data['menu'])) { |
21 | - $data['menu']->items = array_map(function ($item) { |
|
22 | - $item->btnClasses = array_filter($item->classes, function ($class) { |
|
21 | + $data['menu']->items = array_map(function($item) { |
|
22 | + $item->btnClasses = array_filter($item->classes, function($class) { |
|
23 | 23 | return stripos(trim($class), 'btn') === 0; |
24 | 24 | }); |
25 | 25 | $item->classes = array_diff($item->classes, $item->btnClasses); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | return $data; |
33 | 33 | }); |
34 | 34 | |
35 | -add_action('init', function () { |
|
35 | +add_action('init', function() { |
|
36 | 36 | register_nav_menus([ |
37 | 37 | 'navigation_main' => __('Navigation Main', 'flynt-starter-theme') |
38 | 38 | ]); |