| @@ -1,27 +1,49 @@ | ||
| 1 | 1 | <?php |
| 2 | +/** | |
| 3 | + * Registry of the blocks TableKit provides | |
| 4 | + * | |
| 5 | + * @package TableKit | |
| 6 | + */ | |
| 2 | 7 | |
| 3 | 8 | namespace TableBuilder\Config; |
| 4 | 9 | |
| 5 | -defined('ABSPATH') || exit; | |
| 10 | +defined( 'ABSPATH' ) || exit; | |
| 6 | 11 | |
| 7 | -class BlockList | |
| 8 | -{ | |
| 12 | +/** | |
| 13 | + * Provides the filterable list of block definitions TableKit registers. | |
| 14 | + */ | |
| 15 | +class BlockList { | |
| 9 | 16 | |
| 10 | - public static function get_block_list() | |
| 11 | - { | |
| 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 | + */ | |
| 12 | 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. | |
| 13 | 35 | 'tablebuilder/blocks/list', |
| 14 | 36 | array( |
| 15 | - 'table-builder' => array( | |
| 37 | + 'table-builder' => array( | |
| 16 | 38 | 'slug' => 'table-builder', |
| 17 | 39 | 'title' => 'Table Builder', |
| 18 | 40 | 'package' => 'free', |
| 19 | 41 | 'category' => 'general', |
| 20 | 42 | 'status' => 'active', |
| 21 | - 'badge' => ['freemium', 'new', 'beta'], | |
| 43 | + 'badge' => array( 'freemium', 'new', 'beta' ), | |
| 22 | 44 | ), |
| 23 | - 'table-builder-row' => array( | |
| 45 | + 'table-builder-row' => array( | |
| 24 | 46 | 'slug' => 'table-builder-row', |
| 25 | 47 | 'title' => 'Table Row', |
| 26 | 48 | 'package' => 'free', |
| 27 | 49 | 'category' => 'general', |
| @@ -35,9 +57,9 @@ | ||
| 35 | 57 | 'category' => 'general', |
| 36 | 58 | 'parent' => 'table-builder-row', |
| 37 | 59 | 'status' => 'active', |
| 38 | 60 | ), |
| 39 | - 'data-table' => array( | |
| 61 | + 'data-table' => array( | |
| 40 | 62 | 'slug' => 'data-table', |
| 41 | 63 | 'title' => 'Data Table', |
| 42 | 64 | 'package' => 'pro', |
| 43 | 65 | 'category' => 'general', |
| @@ -42,15 +64,15 @@ | ||
| 42 | 64 | 'package' => 'pro', |
| 43 | 65 | 'category' => 'general', |
| 44 | 66 | 'status' => 'active', |
| 45 | 67 | ), |
| 46 | - 'post-table' => array( | |
| 68 | + 'post-table' => array( | |
| 47 | 69 | 'slug' => 'post-table', |
| 48 | 70 | 'title' => 'Post Table', |
| 49 | 71 | 'package' => 'pro', |
| 50 | 72 | 'category' => 'general', |
| 51 | 73 | 'status' => 'active', |
| 52 | - ) | |
| 74 | + ), | |
| 53 | 75 | ) |
| 54 | 76 | ); |
| 55 | 77 | |
| 56 | 78 | return $list; |