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