Storage
4 months ago
Block.php
4 months ago
Block_Collection.php
4 months ago
Block_Field.php
4 months ago
Field.php
4 months ago
Group.php
4 months ago
Legacy_Object.php
4 months ago
Object_Field.php
4 months ago
Page.php
4 months ago
Pod.php
4 months ago
Storage.php
4 months ago
Store.php
4 months ago
Template.php
4 months ago
Block_Collection.php
70 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Pods\Whatsit; |
| 4 | |
| 5 | // Don't load directly. |
| 6 | if ( ! defined( 'ABSPATH' ) ) { |
| 7 | die( '-1' ); |
| 8 | } |
| 9 | |
| 10 | use Pods\Whatsit; |
| 11 | |
| 12 | /** |
| 13 | * Block Collection class. |
| 14 | * |
| 15 | * @since 2.8.0 |
| 16 | */ |
| 17 | class Block_Collection extends Pod { |
| 18 | |
| 19 | /** |
| 20 | * {@inheritdoc} |
| 21 | */ |
| 22 | protected static $type = 'block-collection'; |
| 23 | |
| 24 | /** |
| 25 | * Get list of Block Collection API arguments to use. |
| 26 | * |
| 27 | * @since 2.8.0 |
| 28 | * |
| 29 | * @return array List of Block Collection API arguments. |
| 30 | */ |
| 31 | public function get_block_collection_args() { |
| 32 | $namespace = $this->get_arg( 'namespace', 'pods' ); |
| 33 | |
| 34 | // Block collections are only allowed A-Z0-9- characters, no underscores. |
| 35 | $namespace = str_replace( '_', '-', sanitize_title_with_dashes( $namespace ) ); |
| 36 | |
| 37 | return [ |
| 38 | 'namespace' => $namespace, |
| 39 | 'title' => $this->get_arg( 'title', $this->get_arg( 'label' ) ), |
| 40 | 'icon' => $this->get_arg( 'icon', '' ), |
| 41 | ]; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * {@inheritdoc} |
| 46 | */ |
| 47 | public function get_args() { |
| 48 | $args = Whatsit::get_args(); |
| 49 | |
| 50 | // Pods generally have no parent, group, or order. |
| 51 | unset( $args['parent'], $args['group'] ); |
| 52 | |
| 53 | return $args; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * {@inheritdoc} |
| 58 | */ |
| 59 | public function get_fields( array $args = [] ) { |
| 60 | return []; |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * {@inheritdoc} |
| 65 | */ |
| 66 | public function get_table_info() { |
| 67 | return []; |
| 68 | } |
| 69 | } |
| 70 |