addChild('lastOrders', 'Magento\Backend\Block\Dashboard\Orders\Grid'); $this->addChild('totals', 'Magento\Backend\Block\Dashboard\Totals'); $this->addChild('sales', 'Magento\Backend\Block\Dashboard\Sales'); $isChartEnabled = $this->_scopeConfig->getValue( self::XML_PATH_ENABLE_CHARTS, \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); if ($isChartEnabled) { $block = $this->getLayout()->createBlock('Magento\Backend\Block\Dashboard\Diagrams'); } else { $block = $this->getLayout()->createBlock( 'Magento\Backend\Block\Template' )->setTemplate( 'dashboard/graph/disabled.phtml' )->setConfigUrl( $this->getUrl( 'adminhtml/system_config/edit', ['section' => 'admin', '_fragment' => 'admin_dashboard-link'] ) ); } $this->setChild('diagrams', $block); $this->addChild('grids', 'Magento\Backend\Block\Dashboard\Grids'); parent::_prepareLayout(); } /** * @return string */ public function getSwitchUrl() { if ($url = $this->getData('switch_url')) { return $url; } return $this->getUrl('adminhtml/*/*', ['_current' => true, 'period' => null]); } }