PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.2.2
Pods – Custom Content Types and Fields v3.2.2
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 2 years ago API.php 2 years ago Blocks_Abstract.php 2 years ago Blocks_Interface.php 2 years ago Service_Provider.php 3 years ago
Service_Provider.php
50 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\View;
12
13 /**
14 * Class Service_Provider
15 *
16 * Add Blocks integration.
17 *
18 * @since 2.8.0
19 */
20 class Service_Provider extends \Pods\Service_Provider_Base {
21
22 /**
23 * Registers the classes and functionality needed for the Blocks API.
24 *
25 * @since 2.8.0
26 */
27 public function register() {
28 $this->container->singleton( 'pods.blocks', API::class );
29 $this->container->singleton( 'pods.blocks.collection.pods', Pods::class, [ 'register_with_pods' ] );
30 $this->container->singleton( 'pods.blocks.field', Field::class, [ 'register_with_pods' ] );
31 $this->container->singleton( 'pods.blocks.form', Form::class, [ 'register_with_pods' ] );
32 $this->container->singleton( 'pods.blocks.list', Item_List::class, [ 'register_with_pods' ] );
33 $this->container->singleton( 'pods.blocks.single', Item_Single::class, [ 'register_with_pods' ] );
34 $this->container->singleton( 'pods.blocks.single-list-fields', Item_Single_List_Fields::class, [ 'register_with_pods' ] );
35 $this->container->singleton( 'pods.blocks.view', View::class, [ 'register_with_pods' ] );
36
37 $this->hooks();
38 }
39
40 /**
41 * Hooks all the methods and actions the class needs.
42 *
43 * @since 2.8.0
44 */
45 protected function hooks() {
46 add_action( 'pods_setup_content_types', pods_container_callback( 'pods.blocks', 'register_blocks' ) );
47 add_filter( 'widget_types_to_hide_from_legacy_widget_block', pods_container_callback( 'pods.blocks', 'remove_from_legacy_widgets' ) );
48 }
49 }
50