diff --git a/core/modules/block/block.admin.inc b/core/modules/block/block.admin.inc index 8750744..736ca36 100644 --- a/core/modules/block/block.admin.inc +++ b/core/modules/block/block.admin.inc @@ -300,17 +300,13 @@ function block_admin_configure_submit($form, &$form_state) { } /** - * Form constructor for the custom block deletion form. + * Form constructor for the block instance deletion form. * * @param string $plugin_id * The plugin ID for the block instance. * @param string $theme * The name of the theme for the block instance. * - * @todo Is this form still only for custom blocks? If so, should it and its - * handlers be moved to custom_block.module? If not, the documentation - * should be corrected. - * * @see block_menu() * @see block_admin_block_delete_submit() */ diff --git a/core/modules/block/custom_block/custom_block.admin.inc b/core/modules/block/custom_block/custom_block.admin.inc deleted file mode 100644 index 57017e1..0000000 --- a/core/modules/block/custom_block/custom_block.admin.inc +++ /dev/null @@ -1,48 +0,0 @@ - array( - 'data' => t('Administrative title'), - 'field' => 'cb.info', - ), - 'operations' => array( - 'data' => t('Operations') - ) - ); - $header = array(t('Administrative title'), t('Operations')); - $options = array(); - $results = db_query('SELECT * FROM {block_custom}'); - foreach ($results as $result) { - $options[$result->bid] = array( - array( - l($result->info, 'custom_block/' . $result->bid . '/edit'), - ), - array( - theme('links', array('links' => array(array( - 'title' => t('edit'), - 'href' => 'custom_block/' . $result->bid . '/edit', - 'query' => $destination, - ))) - ), - ), - ); - } - $form['blocks'] = array( - '#type' => 'tableselect', - '#header' => $header, - '#options' => $options, - '#empty' => t('No custom blocks are available.'), - ); - $form['pager'] = array('#markup' => theme('pager')); - return $form; -} diff --git a/core/modules/block/custom_block/custom_block.module b/core/modules/block/custom_block/custom_block.module index 27b1a10..d3e1588 100644 --- a/core/modules/block/custom_block/custom_block.module +++ b/core/modules/block/custom_block/custom_block.module @@ -7,13 +7,13 @@ /** * Implements hook_menu(). - * - * @todo Clarify documentation here about what menu items are being added. */ function custom_block_menu() { $items = array(); + // Add an "Add custom block" action link for each theme. foreach (drupal_container()->get('plugin.manager.system.plugin_ui')->getDefinitions() as $plugin_id => $plugin) { - // We only need this menu item for the block_plugin_ui derivatives. + // Only add the link for block plugin UI derivatives (that is, per-theme + // block instance configuration). if (strpos($plugin_id, 'block_plugin_ui') === 0) { list(, $theme) = explode(':', $plugin_id); $items['admin/structure/block/list/' . $plugin_id . '/add/custom_blocks'] = array( @@ -26,16 +26,6 @@ function custom_block_menu() { 'file' => 'block.admin.inc', 'file path' => drupal_get_path('module', 'block'), ); - $items['admin/structure/block/list/' . $plugin_id . '/add/custom_blocks_library'] = array( - 'title' => 'Custom blocks', - 'description' => 'Administer custom block content.', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('custom_block_admin_custom_block'), - 'access callback' => TRUE, - 'type' => MENU_LOCAL_TASK, - 'file' => 'custom_block.admin.inc', - 'file path' => drupal_get_path('module', 'custom_block'), - ); } } return $items; diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Derivative/CustomBlock.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Derivative/CustomBlock.php index f8f5755..9ff4611 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Derivative/CustomBlock.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Derivative/CustomBlock.php @@ -49,8 +49,6 @@ public function getDerivativeDefinitions(array $base_plugin_definition) { 'format' => $result->format, ) + $base_plugin_definition['settings']; $this->derivatives[$result->bid]['subject'] = $result->info; - // @todo Add an inline comment here explaining why we unset this key. - unset($this->derivatives[$result->bid]['custom']); } $this->derivatives['custom_block'] = $base_plugin_definition; return $this->derivatives; diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/block/block/CustomBlock.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/block/block/CustomBlock.php index abf6e95..3670129 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/block/block/CustomBlock.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/block/block/CustomBlock.php @@ -18,8 +18,7 @@ * subject = @Translation("Custom Block"), * module = "custom_block", * derivative = "Drupal\custom_block\Plugin\Derivative\CustomBlock", - * custom = "TRUE", - * settings = { + * settings = { * "status" = TRUE, * "info" = "", * "body" = "", diff --git a/core/modules/block/lib/Drupal/block/BlockBase.php b/core/modules/block/lib/Drupal/block/BlockBase.php index 506b8ad..9c2be1e 100644 --- a/core/modules/block/lib/Drupal/block/BlockBase.php +++ b/core/modules/block/lib/Drupal/block/BlockBase.php @@ -517,7 +517,6 @@ public function submit($form, &$form_state) { $keys = array( 'visibility' => 'visibility', 'pages' => 'pages', - 'custom' => 'custom', 'title' => 'subject', 'module' => 'module', 'region' => 'region', diff --git a/core/modules/block/lib/Drupal/block/Plugin/system/plugin_ui/BlockPluginUI.php b/core/modules/block/lib/Drupal/block/Plugin/system/plugin_ui/BlockPluginUI.php index e7ffc2c..260eb9e 100644 --- a/core/modules/block/lib/Drupal/block/Plugin/system/plugin_ui/BlockPluginUI.php +++ b/core/modules/block/lib/Drupal/block/Plugin/system/plugin_ui/BlockPluginUI.php @@ -46,7 +46,7 @@ public function form($form, &$form_state, $facet = NULL) { // @todo Add an inline comment here. $plugin_definition = $this->getDefinition(); $manager = new $plugin_definition['manager'](); - $plugins = $this->excludeDefinitions($manager->getDefinitions()); + $plugins = $manager->getDefinitions(); $form['#theme'] = 'system_plugin_ui_form'; $form['instance'] = array( '#type' => 'value', @@ -94,15 +94,6 @@ public function form($form, &$form_state, $facet = NULL) { } /** - * Overrides \Drupal\system\Plugin\PluginUIBase::excludeDefinitions(). - */ - protected function excludeDefinitions(array $definitions) { - return array_filter($definitions, function ($definition) { - return empty($definition['custom']); - }); - } - - /** * Overrides \Drupal\system\Plugin\PluginUIBase::formSubmit(). */ public function formSubmit($form, &$form_state) { diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php index 59ed457..805a1cf 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php @@ -293,15 +293,16 @@ function testBlock() { $edit['blocks[0][region]'] = -1; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); - // Confirm that the block was moved to the proper region. + // Confirm that the block is now listed as disabled. $this->assertText(t('The block settings have been updated.'), 'Block successfully move to disabled region.'); - $this->drupalGet('node'); - $this->assertNoText(t($block['title']), 'Block no longer appears on page.'); - // Confirm that the region's xpath is not available. - // @todo Add a comment describing the pattern that the xpath is matching. + // Confirm that the block instance title and markup are not displayed. + $this->drupalGet('node'); + $this->assertNoText(t($block['title'])); + // Check for