diff --cc core/modules/block/custom_block/custom_block.admin.inc index 8cb5c8c,57351ea..0000000 --- a/core/modules/block/custom_block/custom_block.admin.inc +++ b/core/modules/block/custom_block/custom_block.admin.inc diff --cc core/modules/block/custom_block/custom_block.pages.inc index f6c4076,3390411..0000000 --- a/core/modules/block/custom_block/custom_block.pages.inc +++ b/core/modules/block/custom_block/custom_block.pages.inc @@@ -30,22 -30,35 +30,6 @@@ function template_preprocess_custom_blo } /** - * Page callback: Presents the custom block edit form. - * - * @param Drupal\custom_block\Plugin\Core\Entity\CustomBlock $block - * The custom block to edit. - * - * @return array - * A form array as expected by drupal_render(). - * - * @see custom_block_menu() - */ - function custom_block_edit(CustomBlock $block) { - drupal_set_title(t('Edit custom block %label', array('%label' => $block->label())), PASS_THROUGH); - return Drupal::entityManager()->getForm($block); - } - - /** - * Page callback: Presents the custom block creation form. - * - * @param Drupal\custom_block\Plugin\Core\Entity\CustomBlockType $block_type - * The custom block type to add. - * - * @return array - * A form array as expected by drupal_render(). - * - * @see custom_block_menu() - */ -function custom_block_add(CustomBlockType $block_type) { - drupal_set_title(t('Add %type custom block', array( - '%type' => $block_type->label() - )), PASS_THROUGH); - $block = entity_create('custom_block', array( - 'type' => $block_type->id() - )); - $options = array(); - $request = drupal_container()->get('request'); - if (($theme = $request->attributes->get('theme')) && in_array($theme, array_keys(list_themes()))) { - // We have navigated to this page from the block library and will keep track - // of the theme for redirecting the user to the configuration page for the - // newly created block in the given theme. - $block->setTheme($theme); - } - return entity_get_form($block, 'add'); -} - -/** * Page callback: Form constructor for the custom block deletion form. * * @param Drupal\custom_block\Plugin\Core\Entity\CustomBlock $block diff --cc core/modules/block/custom_block/custom_block.routing.yml index 2178d91,cd96866..0000000 --- a/core/modules/block/custom_block/custom_block.routing.yml +++ b/core/modules/block/custom_block/custom_block.routing.yml @@@ -12,16 -13,24 +12,36 @@@ custom_block_add_page requirements: _permission: 'administer blocks' +custom_block_add_form: + pattern: block/add/{custom_block_type} + defaults: + _content: 'Drupal\custom_block\Controller\CustomBlockController::addForm' + requirements: + _permission: 'administer blocks' + +custom_block_type_delete: + pattern: '/admin/structure/custom-blocks/manage/{custom_block_type}/delete' + defaults: + _entity_form: 'custom_block_type.delete' ++ + custom_block_edit: + pattern: '/block/{custom_block}' + defaults: + _entity_form: 'custom_block.edit' + requirements: + _entity_access: 'custom_block.update' + custom_block: \d+ + + custom_block_type_add: + pattern: '/admin/structure/custom-blocks/add' + defaults: + _entity_form: 'custom_block_type.add' + requirements: + _permission: 'administer blocks' + + custom_block_type_edit: + pattern: '/admin/structure/custom-blocks/manage/{custom_block_type}' + defaults: + _entity_form: 'custom_block_type.edit' requirements: _permission: 'administer blocks' diff --cc core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Core/Entity/CustomBlockType.php index 0ceabd5,2b565a5..0000000 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Core/Entity/CustomBlockType.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Core/Entity/CustomBlockType.php @@@ -21,11 -20,10 +21,12 @@@ use Drupal\custom_block\CustomBlockType * label = @Translation("Custom block type"), * module = "custom_block", * controllers = { - * "storage" = "Drupal\custom_block\CustomBlockTypeStorageController", + * "storage" = "Drupal\Core\Config\Entity\ConfigStorageController", + * "access" = "Drupal\custom_block\CustomBlockTypeAccessController", * "form" = { - * "default" = "Drupal\custom_block\CustomBlockTypeFormController", - * "delete" = "Drupal\custom_block\Form\CustomBlockTypeDeleteForm" ++ * "delete" = "Drupal\custom_block\Form\CustomBlockTypeDeleteForm", + * "add" = "Drupal\custom_block\CustomBlockTypeFormController", + * "edit" = "Drupal\custom_block\CustomBlockTypeFormController" * }, * "list" = "Drupal\custom_block\CustomBlockTypeListController" * },