/** * @param BlockEvent $event */ public function onBlock(BlockEvent $event) { if (!$this->optionService->get('twomartens.core', 'showSystemStats')->getValue()) { return; } $variables = ['systemData' => [['key' => $this->translator->trans('acp.dashboard.blocks.systemstats.os', [], 'TwoMartensCoreBundle'), 'value' => PHP_OS], ['key' => $this->translator->trans('acp.dashboard.blocks.systemstats.webserver', [], 'TwoMartensCoreBundle'), 'value' => isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : ''], ['key' => $this->translator->trans('acp.dashboard.blocks.systemstats.php', [], 'TwoMartensCoreBundle'), 'value' => PHP_VERSION]]]; $content = $this->templating->render('TwoMartensCoreBundle:blocks:systemStatsBlock.html.twig', $variables); $block = new Block(); $block->setId(uniqid()); $block->setSetting('content', $content); $block->setType('sonata.block.service.text'); $event->addBlock($block); }
/** * Tests the getOptions method. */ public function testSetOptions() { $superCategory = $this->optionService->getOptions(); $categories = $superCategory->getCategories(); $firstCategory = $categories[0]; $options = $firstCategory->getOptions(); $firstOption = $options[0]; $firstOption->setValue(false); $this->optionService->setOptions($superCategory); $testOption = $this->optionService->get('twomartens.core', 'optionOne'); $this->assertFalse($testOption->getValue()); }