$questions['fieldable'] = new ConfirmationQuestion('Make the entity type fieldable?', TRUE);
$questions['revisionable'] = new ConfirmationQuestion('Make the entity type revisionable?', FALSE);
$questions['translatable'] = new ConfirmationQuestion('Make the entity type translatable?', FALSE);
+ $questions['bundle'] = new ConfirmationQuestion('The entity type has bundle?', FALSE);
$questions['template'] = new ConfirmationQuestion('Create entity template?', TRUE);
$questions['access_controller'] = new ConfirmationQuestion('Create CRUD permissions?', FALSE);
$questions['title_base_field'] = new ConfirmationQuestion('Add "title" base field?', TRUE);
$vars['entity_base_path'] = '/' . $vars['entity_base_path'];
}
- if ($vars['fieldable']) {
+ if (($vars['fieldable_no_bundle'] = $vars['fieldable'] && !$vars['bundle'])) {
$vars['configure'] = 'entity.' . $vars['entity_type_id'] . '.settings';
}
+ elseif ($vars['bundle']) {
+ $vars['configure'] = 'entity.' . $vars['entity_type_id'] . '_type.collection';
+ }
$vars['class_prefix'] = Utils::camelize($vars['entity_type_label']);
'model.links.menu.yml.twig',
'model.links.task.yml.twig',
'model.permissions.yml.twig',
- 'model.routing.yml.twig',
'src/Entity/Example.php.twig',
'src/ExampleInterface.php.twig',
'src/ExampleListBuilder.php.twig',
'src/Form/ExampleForm.php.twig',
];
- if ($vars['fieldable']) {
+ if ($vars['fieldable_no_bundle']) {
+ $templates[] = 'model.routing.yml.twig';
$templates[] = 'src/Form/ExampleSettingsForm.php.twig';
}
$templates[] = 'config/optional/rest.resource.entity.example.yml.twig';
}
+ if ($vars['bundle']) {
+ $templates[] = 'config/optional/views.view.example.yml.twig';
+ $templates[] = 'config/schema/model.entity_type.schema.yml.twig';
+ $templates[] = 'src/ExampleTypeListBuilder.php.twig';
+ $templates[] = 'src/Entity/ExampleType.php.twig';
+ $templates[] = 'src/Form/ExampleTypeForm.php.twig';
+ }
+
$templates_path = 'd8/module/content-entity/';
$vars['template_name'] = str_replace('_', '-', $vars['entity_type_id']) . '.html.twig';
'model',
'Example',
'rest.resource.entity.example',
+ 'views.view.example',
];
$path_replacements = [
$vars['template_name'],
$vars['machine_name'],
$vars['class_prefix'],
'rest.resource.entity.' . $vars['entity_type_id'],
+ 'views.view.' . $vars['entity_type_id'],
];
foreach ($templates as $template) {