/** * create instance * * @param Handler $handler handler * @param ConfigHandler $configHandler board config handler * @param UrlHandler $urlHandler url handler * @param InstanceManager $instanceManager board instance manager */ public function __construct(Handler $handler, ConfigHandler $configHandler, UrlHandler $urlHandler, InstanceManager $instanceManager) { $this->handler = $handler; $this->configHandler = $configHandler; $this->urlHandler = $urlHandler; $this->instanceManager = $instanceManager; $this->presenter = app('xe.presenter'); $this->presenter->setSettingsSkinTargetId(BoardModule::getId()); $this->presenter->share('handler', $this->handler); $this->presenter->share('configHandler', $this->configHandler); $this->presenter->share('urlHandler', $this->urlHandler); }
/** * create instance */ public function __construct() { /** @var \Xpressengine\Plugins\Board\Plugin $plugin */ $this->plugin = app('xe.plugin')->getPlugin('board')->getObject(); $this->handler = app('xe.board.handler'); $this->configHandler = app('xe.board.config'); $this->permissionHandler = app('xe.board.permission'); $this->urlHandler = app('xe.board.url'); $this->instanceManager = app('xe.board.instance'); $this->presenter = app('xe.presenter'); $this->presenter->setSettingsSkin(Board::getId()); $this->presenter->share('handler', $this->handler); $this->presenter->share('permissionHandler', $this->permissionHandler); $this->presenter->share('configHandler', $this->configHandler); $this->presenter->share('urlHandler', $this->urlHandler); }
/** * test html render popup * * @return void */ public function testShare() { $request = $this->request; $view = $this->view; $theme = $this->theme; $skin = $this->skin; $settings = $this->settings; $instanceConfig = $this->instanceConfig; $presenter = new Presenter($view, $request, $theme, $skin, $settings, $instanceConfig); $presenter->share('key', 'value'); $result = $presenter->getShared(); $this->assertEquals('value', $result['key']); $presenter->share(['key1' => 'value1']); $result = $presenter->getShared(); $this->assertEquals('value1', $result['key1']); }