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
if the machine name + // is my_block_instance_name. $xpath = $this->buildXPathQuery('//div[@id=:id]/*', array(':id' => 'block-' . strtr(strtolower($block['machine_name']), '-', '_'))); - $this->assertNoFieldByXPath($xpath, FALSE, t('Block found in no regions.')); + $this->assertNoFieldByXPath($xpath, FALSE, 'Block found in no regions.'); } /** diff --git a/core/modules/system/lib/Drupal/system/Plugin/PluginUIBase.php b/core/modules/system/lib/Drupal/system/Plugin/PluginUIBase.php index 54afffd..f2c312d 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/PluginUIBase.php +++ b/core/modules/system/lib/Drupal/system/Plugin/PluginUIBase.php @@ -23,7 +23,7 @@ public function form($form, &$form_state) { $plugin_definition = $this->getDefinition(); $manager = new $plugin_definition['manager'](); - $plugins = $this->excludeDefinitions($manager->getDefinitions()); + $plugins = $manager->getDefinitions(); $rows = array(); foreach ($plugins as $plugin_id => $display_plugin_definition) { @@ -51,20 +51,6 @@ public function formSubmit($form, &$form_state) { } /** - * Allows a plugin to exclude certain defintions form the user interface. - * - * @param array $definitions - * The plugin definitions provided by the plugin manager that this user - * interface is exposing. - * - * @return array - * A modified array of what was passed into the method. - */ - protected function excludeDefinitions(array $definitions) { - return $definitions; - } - - /** * Checks access for plugins of this type. * * @return bool diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php index 041d6fe..d423d48 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php @@ -64,22 +64,6 @@ function setUp() { config('system.theme')->set('admin', $this->admin_theme)->save(); theme_disable(array($this->alternate_theme)); - // Add the tools menu block for testing menu items. - // @todo Do this programmatically and with test blocks instead of other - // modules' blocks once block instances are config entities. - $menu_id = 'menu-tools'; - $block_id = 'system_menu_block:' . $menu_id; - $this->adminUser = $this->drupalCreateUser(array('administer blocks')); - $this->drupalLogin($this->adminUser); - - // Add one instance of the user login block. - $edit = array( - 'title' => $this->randomName(8), - 'machine_name' => $this->randomName(8), - 'region' => 'sidebar_first', - ); - $this->drupalPost('admin/structure/block/manage/' . $block_id . '/' . $this->default_theme, $edit, t('Save block')); - $this->drupalLogout(); } /** @@ -358,6 +342,23 @@ function testMenuHierarchy() { * Tests menu link depth and parents of local tasks and menu callbacks. */ function testMenuHidden() { + // Add the tools menu block for testing menu items. + // @todo Do this programmatically and with test blocks instead of other + // modules' blocks once block instances are config entities. + // @todo Why is enabling this block even necessary? + $menu_id = 'menu-tools'; + $block_id = 'system_menu_block:' . $menu_id; + $this->adminUser = $this->drupalCreateUser(array('administer blocks')); + $this->drupalLogin($this->adminUser); + + $edit = array( + 'title' => $this->randomName(8), + 'machine_name' => $this->randomName(8), + 'region' => 'sidebar_first', + ); + $this('admin/structure/block/manage/' . $block_id . '/' . $this->default_theme, $edit, t('Save block')); + $this->drupalLogout(); + // Verify links for one dynamic argument. $links = db_select('menu_links', 'ml') ->fields('ml') diff --git a/core/modules/user/lib/Drupal/user/Plugin/block/block/UserOnlineBlock.php b/core/modules/user/lib/Drupal/user/Plugin/block/block/UserOnlineBlock.php index b0caf90..75f23f0 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/block/block/UserOnlineBlock.php +++ b/core/modules/user/lib/Drupal/user/Plugin/block/block/UserOnlineBlock.php @@ -15,7 +15,7 @@ * Provides a "Who's online" block. * * @todo Move this block to the Statistics module and remove its dependency on - * user_access(). + * {users}.access. * * @Plugin( * id = "user_online_block",