| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
namespace FL\Assistant\Providers; |
| 5 |
|
| 6 |
|
| 7 |
use FL\Assistant\PostTypes\NotationsPostType; |
| 8 |
use FL\Assistant\System\Contracts\ServiceProviderAbstract; |
| 9 |
use System\Contracts\PostTypeAbstract; |
| 10 |
|
| 11 |
class PostTypeServiceProvider extends ServiceProviderAbstract { |
| 12 |
|
| 13 |
protected $post_types = [ |
| 14 |
NotationsPostType::class, |
| 15 |
]; |
| 16 |
|
| 17 |
/** |
| 18 |
* @throws \FL\Assistant\System\Container\InjectionException |
| 19 |
*/ |
| 20 |
public function bootstrap() { |
| 21 |
add_action( 'init', [ $this, 'on_wordpress_init' ] ); |
| 22 |
} |
| 23 |
|
| 24 |
public function on_wordpress_init() { |
| 25 |
foreach ( $this->post_types as $post_type ) { |
| 26 |
/** @var PostTypeAbstract $pt */ |
| 27 |
$pt = $this->injector->make( $post_type ); |
| 28 |
$pt->register(); |
| 29 |
} |
| 30 |
} |
| 31 |
} |
| 32 |
|