Example #1
0
 /**
  * Generates the operations links for running individual reports.
  *
  * @return array
  *   Render array for the operations links for running reports.
  */
 protected function generateReportLinks()
 {
     // These links are put into an 'operations' render array element. They do
     // not look good outside of tables. Also note that the array index in
     // operations links is used as a class on the LI element. Some classes are
     // special in the Seven CSS, such as "contextual", so avoid hitting these
     // accidentally by prefixing.
     $build = array();
     $build['links'] = array('#type' => 'table', '#header' => array($this->t('Report type'), $this->t('Report on')), '#rows' => array());
     $definitions = $this->configList->listTypes();
     $links = array();
     foreach ($definitions as $entity_type => $definition) {
         $links['type_' . $entity_type] = array('title' => $definition->getLabel(), 'url' => Url::fromRoute('config_update_ui.report', array('report_type' => 'type', 'name' => $entity_type)));
     }
     uasort($links, array($this, 'sortLinks'));
     $links = array('type_all' => array('title' => $this->t('All types'), 'url' => Url::fromRoute('config_update_ui.report', array('report_type' => 'type', 'name' => 'system.all'))), 'type_system.simple' => array('title' => $this->t('Simple configuration'), 'url' => Url::fromRoute('config_update_ui.report', array('report_type' => 'type', 'name' => 'system.simple')))) + $links;
     $build['links']['#rows'][] = array($this->t('Configuration type'), array('data' => array('#type' => 'operations', '#links' => $links)));
     // Make a list of installed modules.
     $profile = Settings::get('install_profile');
     $modules = $this->moduleHandler->getModuleList();
     $links = array();
     foreach ($modules as $machine_name => $module) {
         if ($machine_name != $profile) {
             $links['module_' . $machine_name] = array('title' => $this->moduleHandler->getName($machine_name), 'url' => Url::fromRoute('config_update_ui.report', array('report_type' => 'module', 'name' => $machine_name)));
         }
     }
     uasort($links, array($this, 'sortLinks'));
     $build['links']['#rows'][] = array($this->t('Module'), array('data' => array('#type' => 'operations', '#links' => $links)));
     // Make a list of installed themes.
     $themes = $this->themeHandler->listInfo();
     $links = array();
     foreach ($themes as $machine_name => $theme) {
         $links['theme_' . $machine_name] = array('title' => $this->themeHandler->getName($machine_name), 'url' => Url::fromRoute('config_update_ui.report', array('report_type' => 'theme', 'name' => $machine_name)));
     }
     uasort($links, array($this, 'sortLinks'));
     $build['links']['#rows'][] = array($this->t('Theme'), array('data' => array('#type' => 'operations', '#links' => $links)));
     // Profile is just one option.
     $links = array();
     $links['profile_' . $profile] = array('title' => $this->moduleHandler->getName($profile), 'url' => Url::fromRoute('config_update_ui.report', array('report_type' => 'profile')));
     $build['links']['#rows'][] = array($this->t('Installation profile'), array('data' => array('#type' => 'operations', '#links' => $links)));
     return $build;
 }