Skip to content
Snippets Groups Projects
Commit aaa0ea5f authored by baldwinlouie's avatar baldwinlouie Committed by Yas Naoi
Browse files

Issue #3047694 by baldwinlouie, yas, Xiaohua Guan: Merge cloud_server_template and cloud module

parent f4e58ff8
No related branches found
No related tags found
No related merge requests found
Showing
with 354 additions and 264 deletions
......@@ -107,8 +107,7 @@ Directory Structure
cloud (Cloud is a core module for Cloud package)
+-modules (depends on Cloud module)
+-cloud_server_templates
+-modules
- cloud_service_providers
+-cloud_service_providers
- aws_cloud
```
......@@ -120,4 +119,3 @@ Maintainers
- `xiaohua-guan` (https://www.drupal.org/u/xiaohua-guan)
- `shidat` (https://www.drupal.org/u/shidat)
- `Masami` (https://www.drupal.org/u/Masami)
......@@ -66,6 +66,147 @@ function cloud_update_8103() {
}
}
/**
* Migrate cloud server template entity to cloud module.
*
* Backup database before performing this update!
*/
function cloud_update_8110() {
// Flush the cache first.
drupal_flush_all_caches();
// Clear the definition cache.
\Drupal::service('config.typed')->clearCachedDefinitions();
$update_manager = \Drupal::entityDefinitionUpdateManager();
// Update the server template configuration entity.
$server_template_type = $update_manager->getEntityType('cloud_server_template_type');
$server_template_type->set('class', 'Drupal\cloud\Entity\CloudServerTemplateType');
$server_template_type->set('originalClass', 'Drupal\cloud\Entity\CloudServerTemplateType');
$handlers = [
'list_builder' => 'Drupal\cloud\CloudServerTemplateTypeListBuilder',
'form' => [
'add' => 'Drupal\cloud\Form\CloudServerTemplateTypeForm',
'edit' => 'Drupal\cloud\Form\CloudServerTemplateTypeForm',
'delete' => 'Drupal\cloud\Form\CloudServerTemplateTypeDeleteForm',
],
];
$server_template_type->set('handlers', $handlers);
$route_provider = [
'html' => 'Drupal\cloud\Routing\CloudServerTemplateTypeHtmlRouteProvider',
];
$server_template_type->set('route_provider', $route_provider);
$server_template_type->set('provider', 'cloud');
$update_manager->updateEntityType($server_template_type);
// Update the server template definition.
$server_template = $update_manager->getEntityType('cloud_server_template');
$server_template->set('class', 'Drupal\cloud\Entity\CloudServerTemplate');
$server_template->set('originalClass', 'Drupal\cloud\Entity\CloudServerTemplate');
$handlers = [
'storage' => 'Drupal\cloud\CloudServerTemplateStorage',
'list_builder' => 'Drupal\cloud\Controller\CloudServerTemplateListBuilder',
'views_data' => 'Drupal\cloud\Entity\CloudServerTemplateViewsData',
'translation' => 'Drupal\cloud\CloudServerTemplateTranslationHandler',
'form' => [
'default' => 'Drupal\cloud\Form\CloudServerTemplateForm',
'add' => 'Drupal\cloud\Form\CloudServerTemplateForm',
'edit' => 'Drupal\cloud\Form\CloudServerTemplateForm',
'delete' => 'Drupal\cloud\Form\CloudServerTemplateDeleteForm',
'launch' => 'Drupal\cloud_server_template\Form\CloudServerTemplateLaunchConfirm',
],
'access' => 'Drupal\cloud\Controller\CloudServerTemplateAccessControlHandler',
'route_provider' => [
'html' => 'Drupal\cloud_server_template\Routing\CloudServerTemplateHtmlRouteProvider',
],
];
$server_template->set('handlers', $handlers);
$server_template->set('provider', 'cloud');
$update_manager->updateEntityType($server_template);
// Update the configurations.
$config_factory = \Drupal::configFactory();
$config = $config_factory->getEditable('cloud_server_template.cloud_server_template_type.aws_cloud');
$config->setName('cloud.cloud_server_template_type.aws_cloud');
$config->save();
\Drupal::service('config.typed')->clearCachedDefinitions();
drupal_flush_all_caches();
// Update the yml files.
cloud_update_yml_definitions(get_server_template_yml_to_update(), 'aws_cloud');
}
/**
* Remove the old cloud_server_template definition.
*/
function cloud_update_8111() {
// Delete the old cloud_server_template.cloud_server_template_type.aws_cloud.
\Drupal::configFactory()
->getEditable('cloud_server_template.cloud_server_template_type.aws_cloud')
->delete();
// Uninstall the cloud_server_template module.
\Drupal::service('module_installer')->uninstall(['cloud_server_template']);
}
/**
* Yml files to update for server template move.
*
* @return array
* An array of ymls
*/
function get_server_template_yml_to_update() {
return [
'cloud.cloud_server_template_type.aws_cloud.yml',
'core.entity_form_display.cloud_server_template.aws_cloud.default.yml',
'core.entity_view_display.cloud_server_template.aws_cloud.default.yml',
'field.field.cloud_server_template.aws_cloud.field_availability_zone.yml',
'field.storage.cloud_server_template.field_availability_zone.yml',
'field.field.cloud_server_template.aws_cloud.field_description.yml',
'field.storage.cloud_server_template.field_description.yml',
'field.field.cloud_server_template.aws_cloud.field_iam_role.yml',
'field.storage.cloud_server_template.field_iam_role.yml',
'field.field.cloud_server_template.aws_cloud.field_image_id.yml',
'field.storage.cloud_server_template.field_image_id.yml',
'field.field.cloud_server_template.aws_cloud.field_instance_shutdown_behavior.yml',
'field.storage.cloud_server_template.field_instance_shutdown_behavior.yml',
'field.field.cloud_server_template.aws_cloud.field_instance_type.yml',
'field.storage.cloud_server_template.field_instance_type.yml',
'field.field.cloud_server_template.aws_cloud.field_kernel_id.yml',
'field.storage.cloud_server_template.field_kernel_id.yml',
'field.field.cloud_server_template.aws_cloud.field_max_count.yml',
'field.storage.cloud_server_template.field_max_count.yml',
'field.field.cloud_server_template.aws_cloud.field_min_count.yml',
'field.storage.cloud_server_template.field_min_count.yml',
'field.field.cloud_server_template.aws_cloud.field_monitoring.yml',
'field.storage.cloud_server_template.field_monitoring.yml',
'field.field.cloud_server_template.aws_cloud.field_network.yml',
'field.storage.cloud_server_template.field_network.yml',
'field.field.cloud_server_template.aws_cloud.field_ram.yml',
'field.storage.cloud_server_template.field_ram.yml',
'field.field.cloud_server_template.aws_cloud.field_schedule.yml',
'field.storage.cloud_server_template.field_schedule.yml',
'field.field.cloud_server_template.aws_cloud.field_security_group.yml',
'field.storage.cloud_server_template.field_security_group.yml',
'field.field.cloud_server_template.aws_cloud.field_ssh_key.yml',
'field.storage.cloud_server_template.field_ssh_key.yml',
'field.field.cloud_server_template.aws_cloud.field_subnet.yml',
'field.storage.cloud_server_template.field_subnet.yml',
'field.field.cloud_server_template.aws_cloud.field_tags.yml',
'field.storage.cloud_server_template.field_tags.yml',
'field.field.cloud_server_template.aws_cloud.field_termination_protection.yml',
'field.storage.cloud_server_template.field_termination_protection.yml',
'field.field.cloud_server_template.aws_cloud.field_test_only.yml',
'field.storage.cloud_server_template.field_test_only.yml',
'field.field.cloud_server_template.aws_cloud.field_user_data.yml',
'field.storage.cloud_server_template.field_user_data.yml',
'field.field.cloud_server_template.aws_cloud.field_vpc.yml',
'field.storage.cloud_server_template.field_vpc.yml',
];
}
/**
* Update cloud_listing view.
*/
......
......@@ -14,3 +14,24 @@ entity.cloud_config_type.add_form:
title: 'Add Cloud config type'
appears_on:
- entity.cloud_config_type.collection
entity.cloud_server_template.add_form:
route_name: entity.cloud_server_template.add_form
title: 'Add Server Template'
class: 'Drupal\cloud\Plugin\Derivative\CloudServerTemplateLocalAction'
appears_on:
- entity.cloud_server_template.collection
entity.cloud_server_template.collection:
route_name: entity.cloud_server_template.collection
title: 'List Server Template'
appears_on:
- entity.cloud_server_template.add_form
- entity.cloud_server_template.edit_form
- entity.cloud_server_template.delete_form
entity.cloud_server_template_type.add_form:
route_name: entity.cloud_server_template_type.add_form
title: 'Add Cloud Server Template Type'
appears_on:
- entity.cloud_server_template_type.collection
......@@ -24,3 +24,16 @@ entity.cloud_config_type.collection:
description: 'List Cloud config type (bundles)'
parent: system.admin_structure
weight: 99
# Cloud Server Template type menu items definition
entity.cloud_server_template_type.collection:
title: 'Cloud Server Template type'
route_name: entity.cloud_server_template_type.collection
description: 'List Server Template type (bundles)'
parent: system.admin_structure
weight: 99
# Deriver for Cloud Context based collection links.
entity.cloud_server_template.cloud_context.collection:
deriver: 'Drupal\cloud\Plugin\Derivative\CloudServerTemplateMenuLinks'
weigth: 100
......@@ -20,3 +20,31 @@ entity.cloud_config.delete_form:
base_route: entity.cloud_config.canonical
title: Delete
weight: 10
entity.cloud_server_template.canonical:
route_name: entity.cloud_server_template.canonical
base_route: entity.cloud_server_template.canonical
class: '\Drupal\cloud\Plugin\Derivative\CloudServerTemplateTab'
title: 'View'
entity.cloud_server_template.edit_form:
route_name: entity.cloud_server_template.edit_form
base_route: entity.cloud_server_template.canonical
class: '\Drupal\cloud\Plugin\Derivative\CloudServerTemplateTab'
title: 'Edit'
entity.cloud_server_template.delete_form:
route_name: entity.cloud_server_template.delete_form
base_route: entity.cloud_server_template.canonical
class: '\Drupal\cloud\Plugin\Derivative\CloudServerTemplateTab'
title: 'Delete'
entity.cloud_server_template.version_history:
route_name: entity.cloud_server_template.version_history
base_route: entity.cloud_server_template.canonical
title: 'Revisions'
entity.cloud_server_template.launch:
route_name: entity.cloud_server_template.launch
base_route: entity.cloud_server_template.canonical
title: 'Launch'
......@@ -20,6 +20,13 @@ function cloud_help($route_name, RouteMatchInterface $route_match) {
$output = '<p>' . t('The cloud module creates a user interface for users to manage clouds. Users can Create Instances, Describe Instances etc.') . '</p>';
return $output;
case 'help.page.cloud_server_template':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Cloud Server Template') . '</p>';
$output .= '<p>' . t('The cloud_server_template module creates a user interface for users to manage clouds. Users can create server templates.') . '</p>';
return $output;
default:
return '';
}
......@@ -40,6 +47,16 @@ function cloud_theme() {
'variables' => ['content' => NULL],
'file' => 'cloud_config.page.inc',
];
$theme['cloud_server_template'] = [
'render element' => 'elements',
'file' => 'cloud_server_template.page.inc',
'template' => 'cloud_server_template',
];
$theme['cloud_server_template_content_add_list'] = [
'render element' => 'content',
'variables' => ['content' => NULL],
'file' => 'cloud_server_template.page.inc',
];
return $theme;
}
......@@ -59,6 +76,22 @@ function cloud_theme_suggestions_cloud_config(array $variables) {
return $suggestions;
}
/**
* Implements hook_theme_suggestions_HOOK().
*/
function cloud_theme_suggestions_cloud_server_template(array $variables) {
$suggestions = [];
$entity = $variables['elements']['#cloud_server_template'];
$sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
$suggestions[] = 'cloud_server_template__' . $sanitized_view_mode;
$suggestions[] = 'cloud_server_template__' . $entity->bundle();
$suggestions[] = 'cloud_server_template__' . $entity->bundle() . '__' . $sanitized_view_mode;
$suggestions[] = 'cloud_server_template__' . $entity->id();
$suggestions[] = 'cloud_server_template__' . $entity->id() . '__' . $sanitized_view_mode;
return $suggestions;
}
/**
* Implements hook_views_pre_render().
*
......
......@@ -48,3 +48,56 @@ revert all cloud config revisions:
delete all cloud config revisions:
title: 'Delete all revisions'
description: 'Role requires permission to <em>view Cloud config revisions</em> and <em>delete rights</em> for cloud config entities in question or <em>administer cloud config entities</em>.'
# Cloud server template permissions
list cloud server template:
title: 'List server template'
description: 'Allow access to list server template'
# Cloud Server Template entity permissions.
add cloud server template entities:
title: 'Create new Cloud Server Template entities'
administer cloud server template entities:
title: 'Administer Cloud Server Template entities'
description: 'Allow to access the administration form to configure Cloud Server Template entities.'
restrict access: true
delete any cloud server template entities:
title: 'Delete any Cloud Server Template entities'
delete own cloud server template entities:
title: 'Delete own Cloud Server Template entities'
edit any cloud server template entities:
title: 'Edit any Cloud Server Template entities'
edit own cloud server template entities:
title: 'Edit own Cloud Server Template entities'
view any published cloud server template entities:
title: 'View any published Cloud Server Template entities'
view own published cloud server template entities:
title: 'View own published Cloud Server Template entities'
view any unpublished cloud server template entities:
title: 'View any unpublished Cloud Server Template entities'
view own unpublished cloud server template entities:
title: 'View own unpublished Cloud Server Template entities'
access cloud server template revisions:
title: 'Access Cloud Server Template revisions'
revert all cloud server template revisions:
title: 'Revert all Cloud Server Template revisions'
description: 'Role requires permission <em>access Cloud Server Template revisions</em> and <em>edit rights</em> for cloud server template entities in question or <em>administer cloud server template entities</em>.'
delete all cloud server template revisions:
title: 'Delete all revisions'
description: 'Role requires permission to <em>access Cloud Server Template revisions</em> and <em>delete rights</em> for cloud server template entities in question or <em>administer cloud server template entities</em>.'
launch server template:
title: 'Launch server template'
description: 'Allow user to launch server templates'
......@@ -5,3 +5,55 @@ cloud.getData:
_controller: '\Drupal\cloud\Controller\CloudController::getData'
requirements:
_permission: 'access content'
# Cloud Server Template entity view route
entity.cloud_server_template.canonical:
path: '/clouds/design/server_template/{cloud_context}/{cloud_server_template}'
defaults:
_entity_view: 'cloud_server_template'
_title: 'Server Template Content'
requirements:
_entity_access: 'cloud_server_template.view'
entity.cloud_server_template.collection:
path: '/clouds/design/server_template/list/{cloud_context}'
defaults:
_entity_list: 'cloud_server_template'
_title: 'Server Template List'
requirements:
# Use custom access that will check for cloud_context and the desired permission.
# Desired permission is passed as an option in the "perm" variable
_custom_access: '\Drupal\cloud\Controller\CloudConfigController::access'
options:
perm: 'list cloud server template'
# Cloud Server Template Type Form
entity.cloud_server_template.add_form:
path: '/clouds/design/server_template/add/{cloud_context}/{cloud_server_template_type}'
defaults:
_entity_form: cloud_server_template.add
entity_type_id: 'cloud_server_template'
_title_callback: 'Drupal\Core\Entity\Controller\EntityController::addBundleTitle'
bundle_parameter: 'cloud_server_template_type'
requirements:
# Use custom access that will check for cloud_context and the desired permission.
# Desired permission is passed as an option in the "perm" variable
_custom_access: '\Drupal\cloud\Controller\CloudConfigController::access'
options:
perm: 'add cloud server template entities'
parameters:
cloud_server_template_type:
type: 'entity:cloud_server_template_type'
converter: 'paramconverter.entity'
entity.cloud_server_template.launch:
path: '/clouds/design/server_template/{cloud_context}/{cloud_server_template}/launch'
defaults:
_entity_form: cloud_server_template.launch
_title: 'Launch'
requirements:
# Use custom access that will check for cloud_context and the desired permission.
# Desired permission is passed as an option in the "perm" variable
_custom_access: '\Drupal\cloud\Controller\CloudConfigController::access'
options:
perm: 'launch server template'
......@@ -12,3 +12,7 @@ services:
entity.link_renderer:
class: Drupal\cloud\Service\EntityLinkRenderer
arguments: ['@current_route_match', '@class_resolver', '@entity_type.manager']
plugin.manager.cloud_server_template_plugin:
class: Drupal\cloud\Plugin\CloudServerTemplatePluginManager
arguments: ['@module_handler', '@cache.discovery']
......@@ -5,7 +5,7 @@
* Hooks related to cloud_server_template module.
*/
use Drupal\cloud_server_template\Entity\CloudServerTemplateInterface;
use Drupal\cloud\Entity\CloudServerTemplateInterface;
/**
* @addtogroup hooks
......@@ -17,7 +17,7 @@ use Drupal\cloud_server_template\Entity\CloudServerTemplateInterface;
*
* @param array $route
* Associate array with route_name, params.
* @param \Drupal\cloud_server_template\Entity\CloudServerTemplateInterface $cloud_server_template
* @param \Drupal\cloud\Entity\CloudServerTemplateInterface $cloud_server_template
* A Cloud Server Template object.
*/
function hook_cloud_server_template_post_launch_redirect_alter(array &$route, CloudServerTemplateInterface $cloud_server_template) {
......
cloud_server_template.cloud_server_template_type.*:
cloud.cloud_server_template_type.*:
type: config_entity
label: 'Cloud Server Template type config'
mapping:
......
# Defined class is responsible for adding cloud_context into add form link
entity.cloud_server_template.add_form:
route_name: entity.cloud_server_template.add_form
title: 'Add Server Template'
class: 'Drupal\cloud_server_template\Plugin\Derivative\CloudServerTemplateLocalAction'
appears_on:
- entity.cloud_server_template.collection
entity.cloud_server_template.collection:
route_name: entity.cloud_server_template.collection
title: 'List Server Template'
appears_on:
- entity.cloud_server_template.add_form
- entity.cloud_server_template.edit_form
- entity.cloud_server_template.delete_form
entity.cloud_server_template_type.add_form:
route_name: entity.cloud_server_template_type.add_form
title: 'Add Cloud Server Template Type'
appears_on:
- entity.cloud_server_template_type.collection
aws_cloud.instance_type_prices:
route_name: aws_cloud.instance_type_prices
title: 'Instance Type Prices'
appears_on:
- entity.cloud_server_template.add_form
- entity.cloud_server_template.edit_form
options:
attributes:
target: _blank
# Created by yas 2016/06/23.
# Cloud Server Template type menu items definition
entity.cloud_server_template_type.collection:
title: 'Cloud Server Template type'
route_name: entity.cloud_server_template_type.collection
description: 'List Server Template type (bundles)'
parent: system.admin_structure
weight: 99
# Deriver for Cloud Context based collection links.
entity.cloud_server_template.cloud_context.collection:
deriver: 'Drupal\cloud_server_template\Plugin\Derivative\CloudServerTemplateMenuLinks'
weigth: 100
# Updated by yas 2016/06/23.
## Cloud Server Template routing definition
entity.cloud_server_template.canonical:
route_name: entity.cloud_server_template.canonical
base_route: entity.cloud_server_template.canonical
class: '\Drupal\cloud_server_template\Plugin\Derivative\CloudServerTemplateTab'
title: 'View'
entity.cloud_server_template.edit_form:
route_name: entity.cloud_server_template.edit_form
base_route: entity.cloud_server_template.canonical
class: '\Drupal\cloud_server_template\Plugin\Derivative\CloudServerTemplateTab'
title: 'Edit'
entity.cloud_server_template.delete_form:
route_name: entity.cloud_server_template.delete_form
base_route: entity.cloud_server_template.canonical
class: '\Drupal\cloud_server_template\Plugin\Derivative\CloudServerTemplateTab'
title: 'Delete'
entity.cloud_server_template.version_history:
route_name: entity.cloud_server_template.version_history
base_route: entity.cloud_server_template.canonical
title: 'Revisions'
entity.cloud_server_template.launch:
route_name: entity.cloud_server_template.launch
base_route: entity.cloud_server_template.canonical
title: 'Launch'
......@@ -5,74 +5,9 @@
* Provides server template functionality for each cloud sub-system.
*
* Works with Cloud module.
*
* The functionality has been moved to cloud module. This module will be
* removed in the future.
*
* {@deprecated}
*/
use Drupal\cloud\Entity\CloudConfig;
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function cloud_server_template_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the cloud_server_template module.
case 'help.page.cloud_server_template':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Cloud Server Template') . '</p>';
$output .= '<p>' . t('The cloud_server_template module creates a user interface for users to manage clouds. Users can create server templates.') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_theme().
*/
function cloud_server_template_theme() {
$theme = [];
$theme['cloud_server_template'] = [
'render element' => 'elements',
'file' => 'cloud_server_template.page.inc',
'template' => 'cloud_server_template',
];
$theme['cloud_server_template_content_add_list'] = [
'render element' => 'content',
'variables' => ['content' => NULL],
'file' => 'cloud_server_template.page.inc',
];
return $theme;
}
/**
* Implements hook_theme_suggestions_HOOK().
*/
function cloud_server_template_theme_suggestions_cloud_server_template(array $variables) {
$suggestions = [];
$entity = $variables['elements']['#cloud_server_template'];
$sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
$suggestions[] = 'cloud_server_template__' . $sanitized_view_mode;
$suggestions[] = 'cloud_server_template__' . $entity->bundle();
$suggestions[] = 'cloud_server_template__' . $entity->bundle() . '__' . $sanitized_view_mode;
$suggestions[] = 'cloud_server_template__' . $entity->id();
$suggestions[] = 'cloud_server_template__' . $entity->id() . '__' . $sanitized_view_mode;
return $suggestions;
}
/**
* Implements hook_cloud_config_delete().
*/
function cloud_server_template_cloud_config_delete(CloudConfig $cloud_config) {
$ids = \Drupal::entityQuery('cloud_server_template')
->condition('cloud_context', $cloud_config->getCloudContext())
->execute();
if (count($ids)) {
/* @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_manager */
$entity_manager = \Drupal::entityTypeManager();
$entities = $entity_manager->getStorage('cloud_server_template')->loadMultiple($ids);
$entity_manager->getStorage('cloud_server_template')->delete($entities);
}
}
# updated by yas 2016/05/25
# updated by yas 2016/05/23
list cloud server template:
title: 'List server template'
description: 'Allow access to list server template'
add cloud server template entities:
title: 'Create new Cloud Server Template entities'
administer cloud server template entities:
title: 'Administer Cloud Server Template entities'
description: 'Allow to access the administration form to configure Cloud Server Template entities.'
restrict access: true
delete any cloud server template entities:
title: 'Delete any Cloud Server Template entities'
delete own cloud server template entities:
title: 'Delete own Cloud Server Template entities'
edit any cloud server template entities:
title: 'Edit any Cloud Server Template entities'
edit own cloud server template entities:
title: 'Edit own Cloud Server Template entities'
view any published cloud server template entities:
title: 'View any published Cloud Server Template entities'
view own published cloud server template entities:
title: 'View own published Cloud Server Template entities'
view any unpublished cloud server template entities:
title: 'View any unpublished Cloud Server Template entities'
view own unpublished cloud server template entities:
title: 'View own unpublished Cloud Server Template entities'
access cloud server template revisions:
title: 'Access Cloud Server Template revisions'
revert all cloud server template revisions:
title: 'Revert all Cloud Server Template revisions'
description: 'Role requires permission <em>access Cloud Server Template revisions</em> and <em>edit rights</em> for cloud server template entities in question or <em>administer cloud server template entities</em>.'
delete all cloud server template revisions:
title: 'Delete all revisions'
description: 'Role requires permission to <em>access Cloud Server Template revisions</em> and <em>delete rights</em> for cloud server template entities in question or <em>administer cloud server template entities</em>.'
launch server template:
title: 'Launch server template'
description: 'Allow user to launch server templates'
# Updated by yas 2016/06/23.
# Cloud Server Template entity view route
entity.cloud_server_template.canonical:
path: '/clouds/design/server_template/{cloud_context}/{cloud_server_template}'
defaults:
_entity_view: 'cloud_server_template'
_title: 'Server Template Content'
requirements:
_entity_access: 'cloud_server_template.view'
entity.cloud_server_template.collection:
path: '/clouds/design/server_template/list/{cloud_context}'
defaults:
_entity_list: 'cloud_server_template'
_title: 'Server Template List'
requirements:
# Use custom access that will check for cloud_context and the desired permission.
# Desired permission is passed as an option in the "perm" variable
_custom_access: '\Drupal\cloud\Controller\CloudConfigController::access'
options:
perm: 'list cloud server template'
# Cloud Server Template Type Form
entity.cloud_server_template.add_form:
path: '/clouds/design/server_template/add/{cloud_context}/{cloud_server_template_type}'
defaults:
_entity_form: cloud_server_template.add
entity_type_id: 'cloud_server_template'
_title_callback: 'Drupal\Core\Entity\Controller\EntityController::addBundleTitle'
bundle_parameter: 'cloud_server_template_type'
requirements:
# Use custom access that will check for cloud_context and the desired permission.
# Desired permission is passed as an option in the "perm" variable
_custom_access: '\Drupal\cloud\Controller\CloudConfigController::access'
options:
perm: 'add cloud server template entities'
parameters:
cloud_server_template_type:
type: 'entity:cloud_server_template_type'
converter: 'paramconverter.entity'
entity.cloud_server_template.launch:
path: '/clouds/design/server_template/{cloud_context}/{cloud_server_template}/launch'
defaults:
_entity_form: cloud_server_template.launch
_title: 'Launch'
requirements:
# Use custom access that will check for cloud_context and the desired permission.
# Desired permission is passed as an option in the "perm" variable
_custom_access: '\Drupal\cloud\Controller\CloudConfigController::access'
options:
perm: 'launch server template'
# Server Template Plugin Manager
services:
plugin.manager.cloud_server_template_plugin:
class: Drupal\cloud_server_template\Plugin\CloudServerTemplatePluginManager
arguments: ['@module_handler', '@cache.discovery']
......@@ -217,7 +217,6 @@ MOUDLE DEPENDENCY
=================
This module works with the following modules:
- Cloud
- Server Templates
- Libraries
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment