|
@@ -6,11 +6,11 @@ discard block |
|
|
block discarded – undo |
|
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'] . 'screenshot.png'))) { |
|
16
|
16
|
$src = Asset::requireUrl($block['component'] . 'screenshot.png'); |
|
@@ -35,7 +35,7 @@ discard block |
|
|
block discarded – undo |
|
35
|
35
|
return $data; |
|
36
|
36
|
}); |
|
37
|
37
|
|
|
38
|
|
-add_filter('acf/load_field/name=component', function ($field) { |
|
|
38
|
+add_filter('acf/load_field/name=component', function($field) { |
|
39
|
39
|
$componentManager = ComponentManager::getInstance(); |
|
40
|
40
|
$field['choices'] = array_flip($componentManager->getAll()); |
|
41
|
41
|
return $field; |
Please login to merge, or discard this patch.