PluginProbe
Extendify / 3.1.5
Extendify v3.1.5
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / app / QuickEdit / Schemas / Registry.php

Registry.php in Extendify 3.1.5, at app/QuickEdit/Schemas/Registry.php

49 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Extendify\QuickEdit\Schemas;
4
5 defined('ABSPATH') || die('No direct access.');
6
7 class Registry
8 {
9 /**
10 * @var array<string, Schema> blockName => Schema instance
11 */
12 private static $schemas = [];
13
14 public static function register(string $blockName, Schema $schema)
15 {
16 self::$schemas[$blockName] = $schema;
17 }
18
19 public static function get(string $blockName)
20 {
21 return self::$schemas[$blockName] ?? null;
22 }
23
24 public static function init()
25 {
26 self::register('core/paragraph', new Paragraph());
27 self::register('core/heading', new Heading());
28 self::register('core/image', new Image());
29 self::register('core/button', new Button());
30 self::register('core/cover', new Cover());
31 self::register('core/media-text', new MediaText());
32 self::register('core/social-link', new SocialLink());
33 self::register('core/navigation-link', new NavigationLink());
34 self::register('core/navigation-submenu', new NavigationLink());
35 }
36
37 public static function describe(): array
38 {
39 $out = [];
40 foreach (self::$schemas as $name => $schema) {
41 $out[$name] = [
42 'blockName' => $name,
43 'fields' => $schema->fields(),
44 ];
45 }
46 return $out;
47 }
48 }
49