@@ -5,13 +5,13 @@ |
||
5 | 5 | use Timber\Menu; |
6 | 6 | use Flynt\Utils\Asset; |
7 | 7 | |
8 | -add_action('init', function () { |
|
8 | +add_action('init', function() { |
|
9 | 9 | register_nav_menus([ |
10 | 10 | 'navigation_main' => __('Navigation Main', 'flynt-starter-theme') |
11 | 11 | ]); |
12 | 12 | }); |
13 | 13 | |
14 | -add_filter('Flynt/addComponentData?name=NavigationMain', function ($data) { |
|
14 | +add_filter('Flynt/addComponentData?name=NavigationMain', function($data) { |
|
15 | 15 | $data['maxLevel'] = 0; |
16 | 16 | $data['menu'] = new Menu('navigation_main'); |
17 | 17 |
@@ -4,13 +4,13 @@ |
||
4 | 4 | |
5 | 5 | use Timber\Menu; |
6 | 6 | |
7 | -add_action('init', function () { |
|
7 | +add_action('init', function() { |
|
8 | 8 | register_nav_menus([ |
9 | 9 | 'navigation_footer' => __('Navigation Footer', 'flynt-starter-theme') |
10 | 10 | ]); |
11 | 11 | }); |
12 | 12 | |
13 | -add_filter('Flynt/addComponentData?name=NavigationFooter', function ($data) { |
|
13 | +add_filter('Flynt/addComponentData?name=NavigationFooter', function($data) { |
|
14 | 14 | $data['maxLevel'] = 0; |
15 | 15 | $data['menu'] = new Menu('navigation_footer'); |
16 | 16 |
@@ -4,7 +4,7 @@ |
||
4 | 4 | use Flynt; |
5 | 5 | use Timber\Timber; |
6 | 6 | |
7 | -add_filter('Flynt/addComponentData?name=ListPostCards', function ($data) { |
|
7 | +add_filter('Flynt/addComponentData?name=ListPostCards', function($data) { |
|
8 | 8 | $posts = Timber::get_posts([ |
9 | 9 | 'post_type' => 'post', |
10 | 10 | 'posts_per_page' => 4, |
@@ -4,9 +4,9 @@ |
||
4 | 4 | |
5 | 5 | use Flynt; |
6 | 6 | |
7 | -add_filter('Flynt/addComponentData?name=GridDownloadPortrait', function ($data) { |
|
7 | +add_filter('Flynt/addComponentData?name=GridDownloadPortrait', function($data) { |
|
8 | 8 | if (!empty($data['items'])) { |
9 | - $data['items'] = array_map(function ($item) { |
|
9 | + $data['items'] = array_map(function($item) { |
|
10 | 10 | if ($item['itemType'] === 'itemFile') { |
11 | 11 | $fileSize = filesize(get_attached_file($item['file']['id'])); |
12 | 12 | $item['file']['fileSize'] = size_format($fileSize); |
@@ -6,11 +6,11 @@ discard block |
||
6 | 6 | use Flynt\ComponentManager; |
7 | 7 | use Flynt\Utils\Asset; |
8 | 8 | |
9 | -add_filter('Flynt/addComponentData?name=ListComponents', function ($data) { |
|
9 | +add_filter('Flynt/addComponentData?name=ListComponents', function($data) { |
|
10 | 10 | if (!empty($data['componentBlocks'])) { |
11 | - $data['componentBlocks'] = array_map(function ($block) { |
|
11 | + $data['componentBlocks'] = array_map(function($block) { |
|
12 | 12 | $componentPaths = explode('/', $block['component']); |
13 | - $block['component'] = implode('/', array_slice($componentPaths, count($componentPaths)-3, 3)); |
|
13 | + $block['component'] = implode('/', array_slice($componentPaths, count($componentPaths) - 3, 3)); |
|
14 | 14 | |
15 | 15 | if (file_exists(Asset::requirePath($block['component'] . 'preview-desktop.jpg'))) { |
16 | 16 | $src = Asset::requireUrl($block['component'] . 'preview-desktop.jpg'); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | ]; |
23 | 23 | } |
24 | 24 | |
25 | - if (file_exists(Asset::requirePath($block['component']."preview-mobile.jpg"))) { |
|
25 | + if (file_exists(Asset::requirePath($block['component'] . "preview-mobile.jpg"))) { |
|
26 | 26 | $src = Asset::requireUrl($block['component'] . 'preview-mobile.jpg'); |
27 | 27 | list($width, $height) = getimagesize(Asset::requirePath($block['component'] . 'preview-mobile.jpg')); |
28 | 28 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | }); |
46 | 46 | |
47 | 47 | |
48 | -add_filter('acf/load_field/name=component', function ($field) { |
|
48 | +add_filter('acf/load_field/name=component', function($field) { |
|
49 | 49 | $componentManager = ComponentManager::getInstance(); |
50 | 50 | $field['choices'] = array_flip($componentManager->getAll()); |
51 | 51 | return $field; |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | |
6 | 6 | define(__NAMESPACE__ . '\NS', __NAMESPACE__ . '\\'); |
7 | 7 | |
8 | -add_action('wp_enqueue_scripts', function () { |
|
8 | +add_action('wp_enqueue_scripts', function() { |
|
9 | 9 | if (is_user_logged_in()) { |
10 | 10 | Asset::register([ |
11 | 11 | 'type' => 'script', |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | wp_localize_script('Flynt/assets/auth', 'wpData', $data); |
21 | 21 | }); |
22 | 22 | |
23 | -add_action('admin_enqueue_scripts', function () { |
|
23 | +add_action('admin_enqueue_scripts', function() { |
|
24 | 24 | $data = [ |
25 | 25 | 'templateDirectoryUri' => get_template_directory_uri() . '/dist', |
26 | 26 | ]; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | if (is_user_logged_in() || is_admin()) { |
32 | 32 | if (is_admin()) { |
33 | 33 | // add image to the flexible content component name |
34 | - add_filter('acf/fields/flexible_content/layout_title', function ($title, $field, $layout, $i) { |
|
34 | + add_filter('acf/fields/flexible_content/layout_title', function($title, $field, $layout, $i) { |
|
35 | 35 | $componentName = ucfirst($layout['name']); |
36 | 36 | $componentPath = "Components/{$componentName}"; |
37 | 37 | $componentPreviewDesktopPath = Asset::requirePath("{$componentPath}/preview-desktop.jpg"); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | }, 11, 4); |
48 | 48 | } else { |
49 | 49 | // adds Component Previews button to admin bar on front-end when logged in |
50 | - add_action('admin_bar_menu', function ($wpAdminBar) { |
|
50 | + add_action('admin_bar_menu', function($wpAdminBar) { |
|
51 | 51 | $title = __('Component Previews', 'flynt-starter-theme'); |
52 | 52 | $wpAdminBar->add_node([ |
53 | 53 | 'id' => 'toggleComponentPreviews', |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use Flynt; |
6 | 6 | use Timber\Timber; |
7 | 7 | |
8 | -add_filter('Flynt/addComponentData?name=GridPostsSlider', function ($data) { |
|
8 | +add_filter('Flynt/addComponentData?name=GridPostsSlider', function($data) { |
|
9 | 9 | $posts = Timber::get_posts([ |
10 | 10 | 'post_type' => 'post', |
11 | 11 | 'posts_per_page' => -1, |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | use Flynt\Utils\Asset; |
4 | 4 | |
5 | -add_action('wp_enqueue_scripts', function () { |
|
5 | +add_action('wp_enqueue_scripts', function() { |
|
6 | 6 | Asset::register([ |
7 | 7 | 'name' => 'vendor', |
8 | 8 | 'type' => 'script', |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | } |
65 | 65 | }); |
66 | 66 | |
67 | -add_action('admin_enqueue_scripts', function () { |
|
67 | +add_action('admin_enqueue_scripts', function() { |
|
68 | 68 | Asset::register([ |
69 | 69 | 'name' => 'vendorAdmin', |
70 | 70 | 'type' => 'script', |
@@ -32,6 +32,9 @@ |
||
32 | 32 | return $output; |
33 | 33 | } |
34 | 34 | |
35 | + /** |
|
36 | + * @param string $componentName |
|
37 | + */ |
|
35 | 38 | public function renderComponent(Twig_Environment $env, $context, $componentName, $data = [], $withContext = true, $ignoreMissing = false, $sandboxed = false) |
36 | 39 | { |
37 | 40 | $data = $data === false ? [] : $data; |