Skip to content
Snippets Groups Projects
Select Git revision
  • e6999847886f3cb06bbe35ca6edf5185e66790fd
  • master default protected
  • fix/deprecated_functions
  • devel
  • feat/translations
  • feat/upgrade_to_pro_url
  • feat/lang
  • bugfix/require-interface
  • bugfix/require-once-error
  • feature/activation-hooks
  • feature/template-loader
  • feature/template-renderer
  • feature/plugin-activation
  • feature/hookable-object
  • feature/builder-pattern
  • 2.1.2
  • 2.1.1
  • 2.1.0
  • 2.0.0
  • 2.0.0-beta1
  • 1.4.4
  • 1.4.3
  • 1.4.2
  • 1.4.1
  • 1.4
  • 1.3.3
  • 1.3.2
  • 1.3.1
  • 1.3.0
  • 1.2.0
  • 1.1
  • 1.0
32 results

Buildable.php

Blame
  • LegacyDriver.php 906 B
    <?php
    declare( strict_types=1 );
    
    namespace WPDesk\Init\HookDriver;
    
    use Psr\Container\ContainerInterface;
    use WPDesk\Init\HookDriver\Legacy\HooksRegistry;
    
    final class LegacyDriver implements HookDriver {
    
    	/** @var ContainerInterface */
    	private $container;
    
    	public function __construct( ContainerInterface $container ) {
    		if ( ! class_exists( \WPDesk_Plugin_Info::class ) ) {
    			throw new \LogicException( 'Legacy driver cannot be used as the plugin builder component is unavailable. Try running "composer require wpdesk/wp-builder".' );
    		}
    		$this->container = $container;
    	}
    
    	public function register_hooks(): void {
    		HooksRegistry::instance()->inject_container( $this->container );
    
    		$info       = $this->container->get( \WPDesk_Plugin_Info::class );
    		$class_name = $info->get_class_name();
    		$p          = new $class_name( $info );
    		add_action( 'plugins_loaded', [ $p, 'init' ], -45 );
    	}
    }