Xpressengine\Presenter\Presenter::share PHP Method

share() public method

Add a piece of shared data to the environment.
public share ( mixed $key, mixed $value = null ) : null | array
$key mixed key(string|array)
$value mixed value
return null | array
    public function share($key, $value = null)
    {
        if (is_array($key) === false) {
            return $this->shared[$key] = $value;
        }
        foreach ($key as $innerKey => $innerValue) {
            $this->share($innerKey, $innerValue);
        }
        return null;
    }

Usage Example

 /**
  * 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);
 }
All Usage Examples Of Xpressengine\Presenter\Presenter::share