helick /
blocks
| 1 | <?php |
||
| 2 | /* |
||
| 3 | Plugin Name: Helick Blocks |
||
| 4 | Author: Evgenii Nasyrov |
||
| 5 | Author URI: https://helick.io/ |
||
| 6 | */ |
||
| 7 | |||
| 8 | // Require Composer autoloader if installed on it's own |
||
| 9 | if (file_exists($composer = __DIR__ . '/vendor/autoload.php')) { |
||
| 10 | require_once $composer; |
||
| 11 | } |
||
| 12 | |||
| 13 | // Let's compose the registered blocks |
||
| 14 | add_action('carbon_fields_register_fields', function () { |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 15 | /** |
||
| 16 | * Control the list of registered blocks. |
||
| 17 | * |
||
| 18 | * @param array $blocks |
||
| 19 | */ |
||
| 20 | $blocks = apply_filters('helick_blocks', []); |
||
| 21 | |||
| 22 | $blocks = array_filter((array)$blocks, function (string $class) { |
||
| 23 | return $class instanceof \Helick\Blocks\Contracts\Composable; |
||
| 24 | }); |
||
| 25 | |||
| 26 | $blocks = array_unique($blocks); |
||
| 27 | |||
| 28 | array_walk($blocks, static function (string $class) { |
||
| 29 | (new $class)->compose(); |
||
| 30 | }); |
||
| 31 | }); |
||
| 32 | |||
| 33 |