Base.php
56 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Pods\Blocks\Collections; |
| 4 | |
| 5 | // Don't load directly. |
| 6 | if ( ! defined( 'ABSPATH' ) ) { |
| 7 | die( '-1' ); |
| 8 | } |
| 9 | |
| 10 | /** |
| 11 | * Block Collection functionality class. |
| 12 | * |
| 13 | * @since 2.8.0 |
| 14 | */ |
| 15 | abstract class Base { |
| 16 | |
| 17 | /** |
| 18 | * Register the block collection with Pods. |
| 19 | * |
| 20 | * @since 2.8.0 |
| 21 | */ |
| 22 | public function register_with_pods() { |
| 23 | $collection = $this->block_collection(); |
| 24 | |
| 25 | if ( empty( $collection ) ) { |
| 26 | return; |
| 27 | } |
| 28 | |
| 29 | $collection['name'] = $this->slug(); |
| 30 | |
| 31 | pods_register_block_collection( $collection ); |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Get the name/slug of this block collection. |
| 36 | * |
| 37 | * @since 2.8.0 |
| 38 | * |
| 39 | * @return string |
| 40 | */ |
| 41 | public function slug() { |
| 42 | return ''; |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Get block collection configuration to register with Pods. |
| 47 | * |
| 48 | * @since 2.8.0 |
| 49 | * |
| 50 | * @return array Block collection configuration. |
| 51 | */ |
| 52 | public function block_collection() { |
| 53 | return []; |
| 54 | } |
| 55 | } |
| 56 |