PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.3.4
Pods – Custom Content Types and Fields v3.3.4
trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / src / Pods / Blocks / Service_Provider.php
pods / src / Pods / Blocks Last commit date
Collections 4 years ago Types 11 months ago API.php 1 year ago Blocks_Abstract.php 2 years ago Blocks_Interface.php 3 years ago Service_Provider.php 1 year ago
Service_Provider.php
54 lines
1 <?php
2
3 namespace Pods\Blocks;
4
5 use Pods\Blocks\Collections\Pods;
6 use Pods\Blocks\Types\Field;
7 use Pods\Blocks\Types\Form;
8 use Pods\Blocks\Types\Item_List;
9 use Pods\Blocks\Types\Item_Single;
10 use Pods\Blocks\Types\Item_Single_List_Fields;
11 use Pods\Blocks\Types\Related_Item_List;
12 use Pods\Blocks\Types\View;
13
14 /**
15 * Class Service_Provider
16 *
17 * Add Blocks integration.
18 *
19 * @since 2.8.0
20 */
21 class Service_Provider extends \Pods\Service_Provider_Base {
22
23 /**
24 * Registers the classes and functionality needed for the Blocks API.
25 *
26 * @since 2.8.0
27 */
28 public function register() {
29 $this->container->singleton( 'pods.blocks', API::class );
30 $this->container->singleton( 'pods.blocks.collection.pods', Pods::class, [ 'register_with_pods' ] );
31
32 // To add new blocks, also update \Pods\Blocks\API::setup_core_blocks() to call the block.
33 $this->container->singleton( 'pods.blocks.field', Field::class, [ 'register_with_pods' ] );
34 $this->container->singleton( 'pods.blocks.form', Form::class, [ 'register_with_pods' ] );
35 $this->container->singleton( 'pods.blocks.list', Item_List::class, [ 'register_with_pods' ] );
36 $this->container->singleton( 'pods.blocks.related-list', Related_Item_List::class, [ 'register_with_pods' ] );
37 $this->container->singleton( 'pods.blocks.single', Item_Single::class, [ 'register_with_pods' ] );
38 $this->container->singleton( 'pods.blocks.single-list-fields', Item_Single_List_Fields::class, [ 'register_with_pods' ] );
39 $this->container->singleton( 'pods.blocks.view', View::class, [ 'register_with_pods' ] );
40
41 $this->hooks();
42 }
43
44 /**
45 * Hooks all the methods and actions the class needs.
46 *
47 * @since 2.8.0
48 */
49 protected function hooks() {
50 add_action( 'pods_setup_content_types', pods_container_callback( 'pods.blocks', 'register_blocks' ) );
51 add_filter( 'widget_types_to_hide_from_legacy_widget_block', pods_container_callback( 'pods.blocks', 'remove_from_legacy_widgets' ) );
52 }
53 }
54