Xpressengine\Editor\EditorHandler::setInstance PHP Méthode

setInstance() public méthode

Set instance by instance id
public setInstance ( string $instanceId, string $editorId ) : void
$instanceId string instance id
$editorId string editor id
Résultat void
    public function setInstance($instanceId, $editorId)
    {
        if ($editorId !== null && !$this->register->get($editorId)) {
            throw new EditorNotFoundException();
        }
        $this->configManager->set(self::MAP_CONFIG_NAME, [$instanceId => $editorId]);
    }

Usage Example

 public function testSetInstance()
 {
     list($register, $configs, $container, $storage, $medias, $tags) = $this->getMocks();
     $instance = new EditorHandler($register, $configs, $container, $storage, $medias, $tags);
     $register->shouldReceive('get')->once()->with('editor/foo@bar')->andReturn('stdClass');
     $configs->shouldReceive('set')->once()->with(EditorHandler::MAP_CONFIG_NAME, ['someinstanceid' => 'editor/foo@bar']);
     $instance->setInstance('someinstanceid', 'editor/foo@bar');
 }
All Usage Examples Of Xpressengine\Editor\EditorHandler::setInstance