public function ListImportables::render in Default Content 8
1 string reference to 'ListImportables::render'
File
- src/
ListImportables.php, line 45 - Contains \Drupal\defaultcontent\ListImportables.
Class
- ListImportables
- Converts a node to a config entity
Namespace
Drupal\defaultcontentCode
public function render() {
$build['table'] = array(
'#type' => 'table',
'#header' => $this
->buildHeader(),
'#title' => $this
->t('All exported content'),
'#rows' => array(),
'#empty' => $this
->t("There is no exported content in any modules 'content' directory."),
);
foreach (\Drupal::ModuleHandler()
->getModuleList() as $module => $whatever) {
$folder = drupal_get_path('module', $module) . '/content';
//
drupal_set_message("This page doesn't work. Nor does the menu item pointing to it");
foreach (\Drupal::service('defaultcontent.manager')
->getFilesInOrder($folder) as $file) {
print_r($file);
//I'm abandoning it here because life is too short, and this module does what I need.
$entity = \Drupal::service('defaultcontent.manager')
->generateEntity($file, 'node');
if ($row = $this
->buildRow($entity)) {
$build['table']['#rows'][$entity
->id()] = $row;
}
}
}
return $build;
}