@@ -5,13 +5,13 @@ |
||
5 | 5 | use Flynt\Utils\Component; |
6 | 6 | use Timber\Menu; |
7 | 7 | |
8 | -add_action('init', function () { |
|
8 | +add_action('init', function() { |
|
9 | 9 | register_nav_menus([ |
10 | 10 | 'navigation_footer' => __('Navigation Footer', 'flynt-starter-theme') |
11 | 11 | ]); |
12 | 12 | }); |
13 | 13 | |
14 | -add_filter('Flynt/addComponentData?name=NavigationFooter', function ($data) { |
|
14 | +add_filter('Flynt/addComponentData?name=NavigationFooter', function($data) { |
|
15 | 15 | Component::enqueueAssets('NavigationFooter'); |
16 | 16 | |
17 | 17 | $data['maxLevel'] = 0; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | // Convert ACF Field of type relationship to a Timber\Post and add all ACF Fields of that Post |
24 | 24 | add_filter('acf/format_value/type=relationship', NS . 'formatPostObject', 100); |
25 | -add_filter('get_twig', function ($twig) { |
|
25 | +add_filter('get_twig', function($twig) { |
|
26 | 26 | $twig->addExtension(new TwigExtensionFlynt()); |
27 | 27 | return $twig; |
28 | 28 | }); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | function formatGallery($value) |
39 | 39 | { |
40 | 40 | if (!empty($value)) { |
41 | - $value = array_map(function ($image) { |
|
41 | + $value = array_map(function($image) { |
|
42 | 42 | return new Image($image); |
43 | 43 | }, $value); |
44 | 44 | } |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | return $value; |
64 | 64 | } |
65 | 65 | |
66 | -add_action('timber/twig/filters', function ($twig) { |
|
67 | - $twig->addFunction(new \Twig_SimpleFunction('placeholderImage', function ($width, $height, $color = null) { |
|
66 | +add_action('timber/twig/filters', function($twig) { |
|
67 | + $twig->addFunction(new \Twig_SimpleFunction('placeholderImage', function($width, $height, $color = null) { |
|
68 | 68 | $width = round($width); |
69 | 69 | $height = round($height); |
70 | 70 | $colorRect = $color ? "<rect width='{$width}' height='{$height}' style='fill:$color' />" : ''; |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | return crypt(serialize($args), NONCE_SALT); |
81 | 81 | } |
82 | 82 | |
83 | -add_action('timber/twig/filters', function ($twig) { |
|
84 | - $twig->addFilter(new \Twig_SimpleFilter('resizeDynamic', function ($src, $w, $h = 0, $crop = 'default', $force = false) { |
|
83 | +add_action('timber/twig/filters', function($twig) { |
|
84 | + $twig->addFilter(new \Twig_SimpleFilter('resizeDynamic', function($src, $w, $h = 0, $crop = 'default', $force = false) { |
|
85 | 85 | $arguments = [ |
86 | 86 | 'src' => $src, |
87 | 87 | 'w' => $w, |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use Flynt\Utils\Component; |
6 | 6 | use Flynt; |
7 | 7 | |
8 | -add_filter('Flynt/addComponentData?name=ListFacts', function ($data) { |
|
8 | +add_filter('Flynt/addComponentData?name=ListFacts', function($data) { |
|
9 | 9 | Component::enqueueAssets('ListFacts', [ |
10 | 10 | [ |
11 | 11 | 'name' => 'countup', |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use Flynt\Utils\Component; |
6 | 6 | use Flynt; |
7 | 7 | |
8 | -add_filter('Flynt/addComponentData?name=GridPostsSlider', function ($data) { |
|
8 | +add_filter('Flynt/addComponentData?name=GridPostsSlider', function($data) { |
|
9 | 9 | Component::enqueueAssets('GridPostsSlider', [ |
10 | 10 | [ |
11 | 11 | 'name' => 'slick-carousel', |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace Flynt\Features\PasswordForm; |
4 | 4 | |
5 | 5 | use Timber\Timber; |
6 | -use Timber\Post; |
|
7 | 6 | |
8 | 7 | add_filter('the_password_form', function ($output) { |
9 | 8 | $context = Timber::get_context(); |
@@ -8,7 +8,7 @@ |
||
8 | 8 | add_filter('the_password_form', function ($output) { |
9 | 9 | $context = Timber::get_context(); |
10 | 10 | $context['form'] = [ |
11 | - 'url' => site_url('/wp-login.php?action=postpass', 'login_post') |
|
11 | + 'url' => site_url('/wp-login.php?action=postpass', 'login_post') |
|
12 | 12 | ]; |
13 | 13 | |
14 | 14 | return Timber::fetch('index.twig', $context); |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use Timber\Timber; |
6 | 6 | use Timber\Post; |
7 | 7 | |
8 | -add_filter('the_password_form', function ($output) { |
|
8 | +add_filter('the_password_form', function($output) { |
|
9 | 9 | $context = Timber::get_context(); |
10 | 10 | $context['form'] = [ |
11 | 11 | 'url' => site_url('/wp-login.php?action=postpass', 'login_post') |
@@ -6,7 +6,7 @@ |
||
6 | 6 | use Flynt\Utils\Options; |
7 | 7 | use Flynt; |
8 | 8 | |
9 | -add_filter('Flynt/addComponentData?name=ListPosts', function ($data) { |
|
9 | +add_filter('Flynt/addComponentData?name=ListPosts', function($data) { |
|
10 | 10 | Component::enqueueAssets('ListPosts'); |
11 | 11 | |
12 | 12 | return $data; |
@@ -14,7 +14,7 @@ |
||
14 | 14 | function addOptionsToComponent($data, $componentName) |
15 | 15 | { |
16 | 16 | // get fields for this component |
17 | - $options = array_reduce(array_keys(Options::OPTION_TYPES), function ($carry, $optionType) use ($componentName) { |
|
17 | + $options = array_reduce(array_keys(Options::OPTION_TYPES), function($carry, $optionType) use ($componentName) { |
|
18 | 18 | return array_merge($carry, Options::get($optionType, 'Component', $componentName)); |
19 | 19 | }, []); |
20 | 20 | // don't overwrite existing data |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * |
16 | 16 | * @since 0.1.0 |
17 | 17 | * |
18 | - * @param string $feature Name of the feature. |
|
18 | + * @param string $featureName Name of the feature. |
|
19 | 19 | * |
20 | 20 | * @return array|null Returns an array of options or null if the feature wasn't found. |
21 | 21 | */ |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @since 0.1.0 |
34 | 34 | * |
35 | - * @param string $feature Name of the feature. |
|
35 | + * @param string $featureName Name of the feature. |
|
36 | 36 | * @param string $key The option key. |
37 | 37 | * |
38 | 38 | * @return mixed|null Returns the option or null if the option / the feature doesn't exist. |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @since 0.1.0 |
65 | 65 | * |
66 | - * @param string $feature Name of the feature. |
|
66 | + * @param string $featureName Name of the feature. |
|
67 | 67 | * @param string $basePath The feature base path. |
68 | 68 | * @param array $options An array of options. Optional. |
69 | 69 | * |
70 | - * @return boolean |
|
70 | + * @return boolean|null |
|
71 | 71 | */ |
72 | 72 | public static function register($featureName, $basePath, $options = []) |
73 | 73 | { |
@@ -29,6 +29,9 @@ |
||
29 | 29 | return $output; |
30 | 30 | } |
31 | 31 | |
32 | + /** |
|
33 | + * @param string $componentName |
|
34 | + */ |
|
32 | 35 | public function renderComponent(Twig_Environment $env, $context, $componentName, $data = [], $withContext = true, $ignoreMissing = false, $sandboxed = false) |
33 | 36 | { |
34 | 37 | $data = $this->getComponentData($data, $componentName); |