| @@ -1,58 +1,80 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -namespace TableBuilder\Config; | |
| 4 | - | |
| 5 | -defined('ABSPATH') || exit; | |
| 6 | - | |
| 7 | -class BlockList | |
| 8 | -{ | |
| 9 | - | |
| 10 | - public static function get_block_list() | |
| 11 | - { | |
| 12 | - $list = apply_filters( | |
| 13 | - 'tablebuilder/blocks/list', | |
| 14 | - array( | |
| 15 | - 'table-builder' => array( | |
| 16 | - 'slug' => 'table-builder', | |
| 17 | - 'title' => 'Table Builder', | |
| 18 | - 'package' => 'free', | |
| 19 | - 'category' => 'general', | |
| 20 | - 'status' => 'active', | |
| 21 | - 'badge' => ['freemium', 'new', 'beta'], | |
| 22 | - ), | |
| 23 | - 'table-builder-row' => array( | |
| 24 | - 'slug' => 'table-builder-row', | |
| 25 | - 'title' => 'Table Row', | |
| 26 | - 'package' => 'free', | |
| 27 | - 'category' => 'general', | |
| 28 | - 'parent' => 'table-builder', | |
| 29 | - 'status' => 'active', | |
| 30 | - ), | |
| 31 | - 'table-builder-item' => array( | |
| 32 | - 'slug' => 'table-builder-item', | |
| 33 | - 'title' => 'Table Column', | |
| 34 | - 'package' => 'free', | |
| 35 | - 'category' => 'general', | |
| 36 | - 'parent' => 'table-builder-row', | |
| 37 | - 'status' => 'active', | |
| 38 | - ), | |
| 39 | - 'data-table' => array( | |
| 40 | - 'slug' => 'data-table', | |
| 41 | - 'title' => 'Data Table', | |
| 42 | - 'package' => 'pro', | |
| 43 | - 'category' => 'general', | |
| 44 | - 'status' => 'active', | |
| 45 | - ), | |
| 46 | - 'post-table' => array( | |
| 47 | - 'slug' => 'post-table', | |
| 48 | - 'title' => 'Post Table', | |
| 49 | - 'package' => 'pro', | |
| 50 | - 'category' => 'general', | |
| 51 | - 'status' => 'active', | |
| 52 | - ) | |
| 53 | - ) | |
| 54 | - ); | |
| 55 | - | |
| 56 | - return $list; | |
| 57 | - } | |
| 58 | -} | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Registry of the blocks TableKit provides | |
| 4 | + * | |
| 5 | + * @package TableKit | |
| 6 | + */ | |
| 7 | + | |
| 8 | +namespace TableBuilder\Config; | |
| 9 | + | |
| 10 | +defined( 'ABSPATH' ) || exit; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * Provides the filterable list of block definitions TableKit registers. | |
| 14 | + */ | |
| 15 | +class BlockList { | |
| 16 | + | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * Gets the list of blocks TableKit registers, filterable so the Pro | |
| 20 | + * add-on (and third parties) can extend it with additional block definitions. | |
| 21 | + * | |
| 22 | + * @return array<string, array{slug:string,title:string,package:string,category:string,status:string,parent?:string,badge?:string[]}> | |
| 23 | + * Block definitions keyed by block key. | |
| 24 | + */ | |
| 25 | + public static function get_block_list() { | |
| 26 | + /** | |
| 27 | + * Filters the list of block definitions TableKit registers. | |
| 28 | + * | |
| 29 | + * @since Unknown | |
| 30 | + * | |
| 31 | + * @param array $list Block definitions keyed by block key; see get_block_list() for the shape. | |
| 32 | + */ | |
| 33 | + $list = apply_filters( | |
| 34 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores -- slash-namespaced hook name is this plugin's established public API (used by the Pro add-on); renaming would be a breaking change. | |
| 35 | + 'tablebuilder/blocks/list', | |
| 36 | + array( | |
| 37 | + 'table-builder' => array( | |
| 38 | + 'slug' => 'table-builder', | |
| 39 | + 'title' => 'Table Builder', | |
| 40 | + 'package' => 'free', | |
| 41 | + 'category' => 'general', | |
| 42 | + 'status' => 'active', | |
| 43 | + 'badge' => array( 'freemium', 'new', 'beta' ), | |
| 44 | + ), | |
| 45 | + 'table-builder-row' => array( | |
| 46 | + 'slug' => 'table-builder-row', | |
| 47 | + 'title' => 'Table Row', | |
| 48 | + 'package' => 'free', | |
| 49 | + 'category' => 'general', | |
| 50 | + 'parent' => 'table-builder', | |
| 51 | + 'status' => 'active', | |
| 52 | + ), | |
| 53 | + 'table-builder-item' => array( | |
| 54 | + 'slug' => 'table-builder-item', | |
| 55 | + 'title' => 'Table Column', | |
| 56 | + 'package' => 'free', | |
| 57 | + 'category' => 'general', | |
| 58 | + 'parent' => 'table-builder-row', | |
| 59 | + 'status' => 'active', | |
| 60 | + ), | |
| 61 | + 'data-table' => array( | |
| 62 | + 'slug' => 'data-table', | |
| 63 | + 'title' => 'Data Table', | |
| 64 | + 'package' => 'pro', | |
| 65 | + 'category' => 'general', | |
| 66 | + 'status' => 'active', | |
| 67 | + ), | |
| 68 | + 'post-table' => array( | |
| 69 | + 'slug' => 'post-table', | |
| 70 | + 'title' => 'Post Table', | |
| 71 | + 'package' => 'pro', | |
| 72 | + 'category' => 'general', | |
| 73 | + 'status' => 'active', | |
| 74 | + ), | |
| 75 | + ) | |
| 76 | + ); | |
| 77 | + | |
| 78 | + return $list; | |
| 79 | + } | |
| 80 | +} | |