PluginProbe
Tableberg – Simple Gutenberg Table Block / 0.5.7
Tableberg – Simple Gutenberg Table Block v0.5.7
1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 trunk 0.0.2 0.2.1 0.3.2 0.3.3 0.4.1 0.5.0 0.5.1 0.5.2 0.5.3 0.5.4 0.5.5 0.5.6 0.5.7 All 42 releases
tableberg / includes / Patterns / RegisterPatterns.php

RegisterPatterns.php in Tableberg – Simple Gutenberg Table Block 0.5.7, at includes/Patterns/RegisterPatterns.php

51 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Tableberg\Patterns;
4
5 class RegisterPatterns
6 {
7
8 public static function from_dir($dir)
9 {
10 if (!file_exists($dir)) {
11 return;
12 }
13 $files = scandir($dir);
14 foreach ($files as $file) {
15 if ($file == '.' || $file == '..') {
16 continue;
17 }
18 $content = json_decode(file_get_contents($dir . '/' . $file), true);
19 register_block_pattern('tableberg/' . str_replace('.json', '', $file), $content);
20 }
21 }
22
23 public static function upsells()
24 {
25 $dir = __DIR__ . '/upsells';
26 if (!file_exists($dir)) {
27 return;
28 }
29 $files = scandir($dir);
30 foreach ($files as $file) {
31 if ($file == '.' || $file == '..') {
32 continue;
33 }
34 $content = json_decode(file_get_contents($dir . '/' . $file), true);
35 $content['content'] = str_replace('::PLUGIN_URL::', TABLEBERG_URL, $content['content']);
36 register_block_pattern('tableberg/' . str_replace('.json', '', $file), $content);
37 }
38 }
39
40 public static function categories()
41 {
42 register_block_pattern_category('tableberg', array('label' => 'Tableberg'));
43
44 register_block_pattern_category('comparison-table', array('label' => 'Comparison Table'));
45 register_block_pattern_category('featured-box', array('label' => 'Featured Box'));
46 register_block_pattern_category('pricing-table', array('label' => 'Pricing Table'));
47 register_block_pattern_category('pros-cons', array('label' => 'Pros & Cons'));
48
49 register_block_pattern_category('other', array('label' => 'Other'));
50 }
51 }