/** * Configures rendering according to the set variable(s) and calls * render on the parent. * * @return string */ public function render() { if (isset($this->variables['assets'])) { $this->setConfiguration(array('assets' => array('_descendAll' => array('_only' => array('label', 'tags', 'identifier'))))); $this->setVariablesToRender(array('assets')); } else { $this->setConfiguration(array('asset' => array('_only' => array('label', 'tags', 'identifier')))); $this->setVariablesToRender(array('asset')); } return parent::render(); }
/** * Configures rendering according to the set variable(s) and calls * render on the parent. * * @return string */ public function render() { if (isset($this->variables['workspaces'])) { $this->setConfiguration(array('workspaces' => array('_descendAll' => array()))); $this->setVariablesToRender(array('workspaces')); } else { $this->setConfiguration(array('workspace' => array())); $this->setVariablesToRender(array('workspace')); } return parent::render(); }
/** * Configures rendering according to the set variable(s) and calls * render on the parent. * * @return string */ public function render() { if (isset($this->variables['nodes'])) { $this->setConfiguration(array('nodes' => array('_descendAll' => array('_only' => array('name', 'path', 'identifier', 'properties', 'nodeType'))))); $this->setVariablesToRender(array('nodes')); } else { $this->setConfiguration(array('node' => array('_only' => array('name', 'path', 'identifier', 'properties', 'nodeType')))); $this->setVariablesToRender(array('node')); } return parent::render(); }
/** * @test */ public function viewAcceptsJsonEncodingOptions() { $array = ['foo' => ['bar' => 'Baz', 'foo' => '1']]; $this->view->setOption('jsonEncodingOptions', JSON_PRETTY_PRINT); $this->view->assign('array', $array); $this->view->setVariablesToRender(['array']); $expectedResult = json_encode($array, JSON_PRETTY_PRINT); $actualResult = $this->view->render(); $this->assertEquals($expectedResult, $actualResult); $unexpectedResult = json_encode($array); $this->assertNotEquals($unexpectedResult, $actualResult); }