Issue #1535868 by EclipseGc, tim.plunkett, xjm, Jody Lynn, sdboyer, naxoc, tizzo, effulgentsia, dawehner, disasm, beejeebus: Convert all blocks into plugins.
Problem/Motivation
This is the foundational patch for #1696302: [meta] Blocks/Layouts everywhere.
Proposed resolution
The sandbox:
http://drupalcode.org/sandbox/eclipsegc/1441840.git/shortlog/refs/heads/...
This issue:
- Converts Drupal's Block architecture to be plugin-based.
- Enables blocks to be instantiated multiple times in the same theme (i.e., you can add a "Who's Online" block configured to show who's been active the last 5 minutes to your left sidebar, and a "Who's Online" block configured to show who's been active the last 60 minutes to your right sidebar). This will become more useful when we add more useful blocks to the system: i.e., a menu block that can replace both the 'primary links' and 'secondary links' currently hard-coded into page.tpl.php.
- Converts all core blocks to plugins (specifically, to annotated classes implementing the new BlockInterface that is part of this patch).
- Converts all core block configuration to CMI (no more {block} table).
- Adds a "Block Library" UI to the admin/structure/block workflow to incorporate the concept of configured block instances being separate from bare blocks. This UI is very rough and will be improved in follow up issues.
Remaining tasks
The patch for this issue was committed In January. Two change notifications have been filed. At least one additional change notification is still needed. From #406:
@xjm: tried to look into doing a change notice for "change in block template names" but the only new/changed tpl.php I found in the patch was "system-plugin-ui-form.tpl.php" which is a new admin template, not really relevant for blocks themselves. I don't think that is worth a change notice. What did I miss?What I was alluding to is not changes in the names of templates themselves but in 1. render array keys and 2. variable name changes in theme preprocesses. In my reviews above, I commented on this for three places:
+++ b/core/modules/node/node.moduleundefined @@ -1082,11 +1082,11 @@ function node_is_page(Node $node) { - switch ($variables['block']->delta) { - case 'syndicate': + switch ($variables['block']->id) { + case 'node_syndicate_block': ... - case 'recent': + case 'node_recent_block':So this is at least the second time I've seen this, that it's switching from delta to ID. I know that the delta isn't going away from elsewhere in the patch, or at least it still appears to still be there for all intents and purposes. (Or intensive porpoises.) What's the deal? Presumably this will become clear once I read the new architecture. There's also some API change-y stuff going on here that we should make sure gets documented in a change notification. (Presumably this issue will have more than one, since this change is very themer-facing but themers don't care about the stuff we're doing to the base API.)
+++ b/core/modules/openid/openid.moduleundefined @@ -130,20 +130,18 @@ function openid_user_logout($account) { -function openid_block_view_user_login_alter(&$block) { +function openid_block_view_user_login_block_alter(&$build, $block) { @@ -152,10 +150,10 @@ function openid_block_view_user_login_alter(&$block) { - $block['content']['user_links']['#weight'] = 10; + $build['user_links']['#weight'] = 10;Okay, so clearly an API change here that I hope I find to be documented when I get to block.api.php and the issue summary.
+++ b/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.phpundefined @@ -78,7 +78,7 @@ public function execute() { - $info['subject'] = filter_xss_admin($this->view->getTitle()); + $info['#title'] = filter_xss_admin($this->view->getTitle());This hints at another API change.
So, what I think is still needed is a change notice with an example of altering or theming a block to be rendered in D7, and how it changes in D8.
Additionally, the over 50 followups from this issue have not been resolved. Many of the followup issues for this issue were tagged with If SCOTCH fails, including one release blocker: #1875252: [META] Make the block plugin UI shippable. On Feb. 18, when Blocks and Layouts was feature-complete for whatever would be in Drupal 8, these issues were to be unpostponed, and t be the initiative's focus for the next phase of the release cycle. (See below.) This did not happen as agreed, and the issues are still outstanding.
See comment #294 for a review of the full patch. See #108 for an earlier review of the interface's architecture. For the core maintainers' feedback on this patch, see #307.
Followup issues
Also see the initiative roadmap at #1696302: [meta] Blocks/Layouts everywhere.
-
Bugs and regressions introduced by this patch
- #1882252: Regression: Block visibility summaries are broken
- #1881176: Revert bogus User module update number changes of Blocks to Plugins conversion
- #1881096: Regression: Site broken when disabling module without removing block instances.
- #1880588: Regression: invalid HTML in menu blocks due to _block_get_renderable_block() clobbering #theme_wrappers of block contents
- #1880504: Regression: incorrect default blocks and weights in Standard profile following plugin conversion
-
The architecture needs review.
Specific points of concern follow. In each case, we should determine whether it is appropriate to explore the question in a followup, or whether it needs to be addressed more before this patch is committed.
- #1871772: Convert custom blocks to content entities
- #1871696: Convert block instances to configuration entities to resolve architectural issues
- #1880274: Reimplement block visibility settings
- #1875340: Review PluginUI architecture
- Needs followup issue
The definition of menu items for the plugin UI needs review and possibly refactoring. - Needs followup issues
The logic and code flow for core blocks'build()implementations needs work:There seems to be a lot of variation on where the business logic resides for what get built in build(). In some cases, as here, queries happen directly in the method. In others, the method calls the module's procedural API to get the data. In one case (Poll), the logic is in the access method. Most memorably of all, in Comment, the logic is in a theme function.
- #1874498: Provide and use API methods for retrieving base plugin and derivative names from block plugin IDs
- #1879370: Add test coverage for the "disabled" block status.
- Needs followup issue
The correct usage of the block$configurationvariable,BlockBase::getConfig(),BlockBase::setConfig(),BlockBase::settings(), and the settings in the block plugin annotation is not clear and there is a lot of overlap. See also #1764380: Merge PluginSettingsInterface into ConfigurableInterface.
-
The new classes and interfaces introduced by the patch need detailed documentation.
The patch includes numerous
@todoswhere more documentation should be added. See #297 for a complete list. Followup issues:- #1871762: Add detailed documentation explaining the block system's architecture
- #1874576: Improve the documentation and naming of hook_block_view_alter() hooks
- #1875942: Improve PluginUI documentation
- #1879396: Add inline documentation to BlockBase::validateConfigurationForm() and BlockBase::submitConfigurationForm()
-
There are gaps in the test coverage
See #294 and #337 for additional details.
- #1874830: Add a test block plugin implementation with test coverage
- #1874840: Add explicit test coverage for the BlockPluginUI
- #1874822: Add functional test coverage for placing multiple blocks
- #1874598: Add BlockTestBase
- #1875344: Add back removed test coverage in Views' OverrideDisplaysTest
- #1874590: Improve test coverage for BlockTemplateSuggestionsUnitTest
- #1879896: Add web tests for module-specific block definitions cache invalidation
-
There is no upgrade path.
#1871700: Provide an upgrade path to the new Block architecture from Drupal 7
(see also #1887688: locale_update_8001() references unused block tables) -
The patch has not been fully benchmarked.
Commit blocker. File followups as appropriate. See #338.
The following issues will likely be important for making the new architecture more performant:
-
The user interface will need review and testing (as a followup).
The actual user interface will probably need user testing and refinement at some point. It probably does not make sense to do this yet, since one of the goals of the Blocks and Layouts initiative is to create a streamlined workflow for placing blocks in layouts.
- #1841584: Add and configure master displays
- #1871746: Add modal block browser
- #1840500: Add simple blank page creation capability
- Add context dependent blocks/pages
Other usability issues
- #1875260: Make the block title required and allow it to be hidden
- #1874584: "Block Library" link label is unclear
- #1875016: Automatically generate machine names for block plugins
- #1875058: Provide separate interface for editing custom blocks
- #1875780: "Configure block" button text in the Block Library is confusing
-
Other cleanups and followups.
- #1875996: Reconsider naming conventions for derivative classes
- #1875770: Reconsider BlockBase::block*() method names
- #1872540: Provide a test helper method for creating block instances
- #1874982: CSS bugs in the Block Library UI
- #1879256: Refactor viewSpecialBlocks architecture once blocks are plugins
- #1879436: Clean up node_block_list_alter()
- #1874502: Clean up theme demo help in block_help()
- #1867864: Assertion message in BlockUpgradePathTest makes no sense
- #1874564: Fix access handling SystemMenuBlock::access()
- #1879930: Language selectors are not showing localized to the page language
- May need followup issue
_block_get_renderable_block()should have a typehint enforcing that the passed parameter is an array. - #1871854: Decide whether to restore per-user block visibility or provide it in contrib
- #1879496: Do we need to worry about plugin ID collisions?
- #1839904: Rename plugin.core.block CMI prefix to block.block
- #1887692: Clean up unused {block_node_type} table and references
Others TBD. I'll add in the non-critical tasks and followups later. All the things mentioned under "Followups" in #246 on, plus the fix needed to
hook_schema(), config and plugin names/IDs/deltas, etc.
Other related issues
- #1823450: [Meta] Convert core listings to Views
- #1821658: Plugin derivatives calling disabled modules in tests
- #1727392: Minor logic fix for Derivates Decorator
- #1722882: Plugin CacheDecorator caches globally, ignores request context, and does not specify tags for cache items
- #1826452: Do not alter forms after calling drupal_get_form()
- #1780396: Namespaces of disabled modules are registered during test runs
- #1591806: Change block "subject" so that it's called a (admin_)label like everything else on the theme layer
- #731724: Convert comment settings into a field to make them work with CMI and non-node entities
- #1852454: Restrict module and theme name lengths to 50 characters
- #1776830: [META-1] Installation and uninstallation of configuration provided by a module that belongs to another module's API
- #1186034: Length of configuration object name can be too small
- #1760358: Provide a way to extract the ID from a config object name
- #1701014: Validate config object names
- #1304470: Add tests for module-provided contextual links on blocks
- #1053648: Convert site elements (site name, slogan, site logo) into blocks
- #507488: Convert page elements (local tasks, actions) into blocks
- #1869476: Convert global menus (primary links, secondary links) into blocks
- #1835496: Factor {users_field_data}.access out of the table and entity caches
- #276493: Tests needed: aggregator.module
User interface changes
Instead of all blocks being listed on admin/structure/block, only configured instances are listed.
There's a new "Block Library" link to add additional block instances. (The text of this link may be changed in #1874584: "Block Library" link label is unclear.)

This link takes you to a browser that allows you to pick which block you want to add, with an additional link to add a new custom block if the Custom Block module is enabled. (See also: #1874982: CSS bugs in the Block Library UI, #1875780: "Configure block" button text in the Block Library is confusing, #1875058: Provide separate interface for editing custom blocks.)

When you edit a new instance, you can give the block a custom title, or use the default title. You also give this instance a specific machine name (though we might generate a default machine name automatically, see #1875260: Make the block title required and allow it to be hidden and #1875016: Automatically generate machine names for block plugins).

You can also adjust the configuration of existing block instances as you previously would, by clicking the "configure" operation from the block administration page.

API changes
TODO: Fill in this section. See #281.
Blood Oath
We, the undersigned, do hereby avow that we will work on If SCOTCH fails issues after February 18:
EclipseGc
sdboyer
| Comment | File | Size | Author |
|---|---|---|---|
| #376 | block_library_action.png | 18.66 KB | xjm |
| #376 | block_library.png | 34.16 KB | xjm |
| #376 | existing_instance.png | 22.98 KB | xjm |
| #376 | new_instance.png | 24.61 KB | xjm |
| #375 | block_plugins_80_runs.png | 42.23 KB | msonnabaum |
Comments
Comment #1
eclipsegc commentedI fully expect tests to fail here, there's lots of stuff that doesn't have updated tests because of how much it has changed.
Comment #2
eclipsegc commentedUpdated patch
Comment #3
effulgentsia commentedYay. Thanks so much for posting this! A lot of great progress so far. I'm sure I'll have more feedback as I digest all of this more, but here's what initially jumped out at me.
Is this just a merge artifact, or is this somehow related to blocks?
Can this be removed now that #1467126: PSR-0 namespace auto registration for modules landed?
Here and elsewhere in Drupal\Core\Config: is this addition needed? I don't see what in the rest of the patch uses this.
What happens to 'status' in the new architecture?
Can we keep hook_block_view_alter(), and just change module/delta to id, rather than removing the hook entirely?
Can we call this view()? See #658364: Does build/view/formatter terminology make sense?.
Comment #4
effulgentsia commentedAlso, I'm wondering if this is combining plugin definition and plugin instance settings into 1 config file, and if we really want that.
Comment #5
eclipsegc commentedIs a merge artifact. I got it from somewhere, and just assumed it was still needed. It is not for anything I need.
Yes, this can probably be removed.
This was being used before plugins were updated to not need DrupalConfig objects, so no, at this point blocks doesn't need it, but I can totally see the utility within CMI, and think it SHOULD exist. That being said it certainly doesn't belong in this patch.
Status, even now, is kind of obtuse. Ultimately, I don't really see a use for it since we'll have visibility settings through condition plugins, and placement through layouts and variations of layouts. I'm not sure I see a need, so unless someone has a really good example use case of why we still need it, I think we can forgo it.
We'd probably need to pass the UUID for the block through so hook_block_view_$uuid_alter for the specific... I'm not sure it's a debate I care to have, though we might run it past merlin. All in all I'm ok with it if we think it's necessary, but a lot of this stuff is one-off configurable instance sort of information, so I'm not sure why you'd want to change that through code when you have access to change it through UI already. Again I think use case here, cause what we'd be altering is actually the configuration for the block.
I am not sold on any specific naming convention, so sure, build(), view(), render(), whatever()... we might bike shed little things like this a bit, but I don't honestly care, if view the consensus, I'm on board.
This isn't mixing instance and definition configuration, this is providing default instance configuration within the plugin, i.e. we need a default block_count for aggregator category in the config form. Normally variable_get() would have provided this mechanism for us, CMI does not do so, and providing such defaults is REALLY ugly. This is very similar to what ctools does for presetting instance configuration of its plugins as well, so I think neclimdul and merlin would probably ++ the spirit of what this is doing.
Hopefully that answers your initial questions. Let me know if you have others.
Eclipse
Comment #6
effulgentsia commentedThanks for the answers. I just have a couple follow-ups:
The cool thing about drupal_alter() is we can do multiple specifics. For example,
The one use-case we have in core is http://api.drupal.org/api/drupal/core!modules!menu!menu.module/function/menu_block_view_alter/8">menu_block_view_alter(), though there's others in contrib. This is menu.module enhancing system menu blocks, and is a good use-case for altering based on $base_plugin_id. True, this use-case could also be implemented by menu.module defining its own block plugin that inherits from system menu's plugin, so I'll try to dig up some use-cases where alter would clearly be better than inheritance.
Ah. I think I got tripped up by <region> but you address that in the issue summary. Yeah, this default instance settings makes sense at least until CMI solves it more generically, and maybe even after that.
Comment #7
effulgentsia commentedOne reason for menu.module to use alter of the system menu blocks instead of defining its own block plugin for the system menus: if it did the latter, and you wanted contextual links, you'd have to remove the system block instances from your layout, and add the menu block versions. Then, suppose you disable menu.module. Now you have to go and re-add the system blocks. Not a huge deal, but still shows the desirability of enhancing existing blocks via alter().
Comment #8
eclipsegc commentedActually, as it stands currently, menu blocks and system menu blocks are actually exposing totally different menus (i.e. system menus and user generated menus). But I get where you're going with this... also while derivatives aren't working right now, check out the menu block class. :-D I think you'll like it if you've not looked real hard yet.
As I said, I'm not opposed to doing this, though after a weekend of working on twig and theme layer stuff, I'm wondering about the use cases that we typically see for this function, but that is sort of a separate concern perhaps.
Comment #9
sunClarifying title according to #1696302: [meta] Blocks/Layouts everywhere, bumping priority, and tagging for architectural review for @drupalchanges.
Comment #10
sunComment #11
eclipsegc commentedWanted to post an update of this. The block have all been converted to the new plugin system.
A few highlights and noteworthy points:
Hopefully that gives some good stuff to work from here. The patch will remove all block hooks EVERYWHERE. The only thing that is left is hook_preprocess_block, and that sort of makes sense to leave alone in my opinion. At least for the time being. I have some ideas about how this might could be made redundant as well, but more on that later.
There's no caching around the annotation discovery. This is great for development purposes, it means creating new blocks happens effortlessly, also the CacheDecorator is getting some love over here: #1722882: Plugin CacheDecorator caches globally, ignores request context, and does not specify tags for cache items. Obviously once that is squared away, a CacheDecorator would be used for blocks.
I have tested to see if this installs properly and it does. No blocks will be enabled by default, but due to how drupal currently handels the main content block, that's not a problem. You can easily start adding content into regions. All blocks have default regions assigned to them, this would obviously go away in the final product, but it was convenient for the time being. You can, of course, move them. A lot of untested stuff in here, should totally fail tests, but the patch should at least be interesting at this point.
Eclipse
PS: For those of you who've looked at the older patches, I removed all the conditions module work I was doing in favor of keeping this as straight forward as possible. There's already a ton of stuff in here, no reason to pollute it with non-essentials.
Comment #12
eclipsegc commentedAlso, my existing use of UUIDs should likely be moved to a standard "machine_name" model. Doing so would kill #334759: Add machine names for custom blocks.
Comment #13
eclipsegc commentedThis is a little updated patch that utilizes the new Symfony Bundles to register the BlockManager class in the Dependency Injection Container.
Comment #14
eclipsegc commentedThis patch includes some pretty significant UI changes. I hope to have default blocks in the install profile later today. We will see.
Eclipse
Comment #15
aspilicious commentedI know you're working on this patch for a long time. But to be honest I didn't knew it was this nice alrdy.
I'm just going to say *everything* I noticed.
1) All the blocks are gone after applying the patch. And update.php whitescreens.
2) The block library is *awesome*. The gui is smooth and clean and easy...
3) Added only an aggregator category no feeds attached. I'm also wondering why I see the same errors multiple times. Maybe the results are not cached?
Notice: Undefined property: Drupal\aggregator\Plugin\Derivative\CategoryBlock::$config in Drupal\aggregator\Plugin\Derivative\CategoryBlock->getDerivativeDefinitions() (line 30 of core\modules\aggregator\lib\Drupal\aggregator\Plugin\Derivative\CategoryBlock.php).
Notice: Undefined property: Drupal\aggregator\Plugin\Derivative\CategoryBlock::$config in Drupal\aggregator\Plugin\Derivative\CategoryBlock->getDerivativeDefinitions() (line 30 of core\modules\aggregator\lib\Drupal\aggregator\Plugin\Derivative\CategoryBlock.php).
Notice: Undefined index: module in block_library_block_form() (line 317 of core\modules\block\block.admin.inc).
Notice: Undefined index: module in block_library_block_form() (line 317 of core\modules\block\block.admin.inc).
Comment #16
eclipsegc commentedYeah, I'm not even the slightest amount of interested in an upgrade path right now, because this is an intermediary UI designed to give us a good foundation to continue working, but no our final, so I think any upgrade path would be a waste of time right now. Also, various aspects of the system are still in flux.
Glad you're liking the library, it has some tweaks yet that need to be made and I'm sure someone else can hit it with the css stick better than I did in a single pass.
I'd really encourage you to apply the patch against a fresh code base and THEN install, not the other way around. If you do so, please let me know if you still experience problems with the aggregator block(s). I've tried to test everything, but the code has changed quite a bit, and I don't promise that it's perfect ;-)
Eclipse
Comment #17
eclipsegc commentedThis UI should be a lot better, there's now a UI per theme (much like there was before) however each block instance is per theme, instead of allowing a single instance to support multiple regions in multiple themes. I debated this for a long long time, but functionally, it should be fairly similar to how this would work for layouts, even if architecturally it's different.
region defaults were removed from all blocks. I consider this a pretty big win. The next major steps for this patch are to remove the settings array from the annotations entirely in favor of a method on the class, as well as getting some default configuration in place for the initial install.
Default Configuration:
This is actually a really interesting topic... initially I thought I was going to put this configuration into the install profile, and indeed some of it could, and likely should end up there, but by the same token I wonder if a theme should carry default configuration (so that things like help and main content end up in the right regions by default). I'd love some discussion on this topic, I think this patch is coming along nicely.
Eclipse
Comment #18
eclipsegc commentedoops, missed the patch
Comment #19
catch(haven't reviewed anything yet, just changing status).
Comment #20
eclipsegc commentedOh, this should totally fail testing for a number of reasons.
1.) I've not updated tests to match the new functionality yet
2.) Last I knew the Symfony Bundles don't work outside of the index.php approach
Still, sort of interested to see what happens :-)
Eclipse
Comment #24
jody lynnHere's an additional patch (interdiff with #18) that updates testBlock in BlockTest.php.
I switched from using the Navigation menu block to using the Powered by Drupal block in testBlock, because the appearance of the Navigation menu relies on having access to a menu item there, which seemed like unnecessary extra complexity.
testBlockRehash in BlockTest.php is also in the patch but is not complete (see TODO).
All other tests in BlockTest.php cannot be fixed yet as they relate to adding custom blocks and block visibility (not yet implemented).
Comment #25
jody lynnNoticed a stray line in the last patch. Updated patch, better filename.
Comment #27
jody lynnFYI: _block_get_renderable_region function needs attention as it still uses module, delta
Comment #28
jody lynnNew patch, now covers BlockCacheTest and BlockHtmlIdTest as well.
Comment #29
jody lynntestBlockRehash and testBlockInInvalidRegion cite the concept of 'block rehashing' but I notice _block_rehash is gone, so maybe we don't need to test it anymore, or...
Comment #30
eclipsegc commentedI haven't addressed any of Jody's questions or concerns, but I have included her tests! This is rerolled against head, and includes an abstraction of the UI that was used for blocks so that other systems (conditions for example) could make use of it. Still trying to decide if we should get conditions working on this patch or just get block visibility working and delete it later. Thoughts welcome.
Eclipse
Comment #31
eclipsegc commentedthis I missed the tests.
Comment #32
eclipsegc commentedor not... whatever...
Comment #33
effulgentsia commentedMy general inclination with large patches is to introduce as few new concepts as possible. Many concepts + many lines of code = patch sits in the queue with insufficient reviews for too long. So I'm +1 to punting conditions to a separate follow-up issue.
Comment #35
eclipsegc commentedyeah, the only problem is that we'll have to get a system that is currently broken working only to promptly remove it. Still perhaps you're correct.
Comment #36
jody lynnHere's a custom block module to provide a custom block plugin.
Let me know how this is looking and I'll move on to fixing all the block tests that need custom blocks.
Comment #37
tim.plunkettNo trailing commas in annotations :(
This makes sense to me.
Comment #38
jody lynnNew patch for tim.
Comment #39
tim.plunkettOn the patch in #31
namespace Drupal\block\Plugins\Type;namespace Drupal\aggregator\Plugin\block\block;I would think both would be Plugin (singular).
Comment #40
sunMerged in HEAD. (layout-blocks-1535868-sun, based on 8.x-blocks)
interdiff wasn't possible, bailed out with errors. However, I did not perform any other changes than merging in HEAD.
Comment #42
sun- #1786990: [Module]Bundle is registered too late in WebTestBase::setUp() by sun: Stop-gap fix for unavailable module bundles in web tests.
Comment #44
eclipsegc commentedOK, added a first pass at custom blocks, I don't expect any new tests to start magically passing, but at least we'll have the start of something we can being converting the tests to.
Highlights:
Custom blocks can be created from a local action on the Block Library page. New instances of pre-existing blocks can be spawned from the block library itself. The content of the block cannot be updated from there, a separate administration has been constructed for that, though the actual administration of that has not been done yet, it is purely placeholder to communicate my intentions.
Given how this went, I'm heavily leaning towards converting this to an entity now. Sun, Indytechcook and Jodyh all seem on board for that approach, and I think it fixes a number of WTFs at the moment.
WTFs:
Status is a thing on blocks... it doesn't make a lot of sense at the moment, but for custom entities as blocks it could make a lot of sense.
All custom blocks are currently reusable, and that's unlikely to be true in the long term, rather specific blocks would likely want to be marked as being reusable.
Custom block edit form is going to end up being kind of weird since it needs to serve as display (to some extent) within the block configuration, as well as serving as a "creation" mechanism there, while edits happen outside of blocks, because you're not changing the instance, you're changing the content the instance references and... yeah, it's just sort of annoying and weird right now. I think entities would sort of stitch it all together nicely.
Hopefully this all made sense. Try out the patch, and let me know.
Eclipse
Comment #46
eclipsegc commentedI've put a lot of work into getting most of the visibility rules working. language rules still need to be updated to work, but overall, they should be working here. This patch required quite a bit of my time today, many Bothans died to bring you this patch.
The tests really need love at this point, I'll be working on language stuff here next, and then we need to finish the custom blocks patch and then clean this thing up. Please install and play, as soon as language visibility is working, I'll be cleaning up the patch to make sure all the functions are sensibly named, and remove the default settings from the annotations.
Eclipse
Comment #48
eclipsegc commentedI've not rerolled this against head, but it applies as of: c259b8ec521d75c5018cb9c4b2626413e9c0b2dc I'll reroll this weekend likely.
Thing of note:
All visibility rules should work at this point.
All the hooks that alter block visibility rules have been updated.
Various comment clean up to reflect new architecture.
Updated function names that no longer made sense. (mostly having to do with custom blocks in the main block module and admin)
Removed a ton of code that was no longer executed in the main block.module.
Updated the derivatives variable to default to array(). This removes some of the errors seen in calls to getDefinitions for the block manager class.
Restructured the base class to include configuration/validate/submit/access wrappers to prevent the need for block plugins to ever call parent::method() of any sort.
Cleaned up a handful of things that were apparent errors in various block plugins.
Moved settings in the annotation definitions to a settings method.
Removed the Evaluation annotation class.
Moved the ConfigMapper to Drupal\Core\Plugin\Mapper
Moved the BlockManager class out of Plugins\Type to Plugin\Type (per typical standard).
This is a significant set of changes from the previous patch. I think custom_blocks is totally borked at this point which is fine, cause it's going to need some serious love anyway. I updated every other block in the system. Barring finding any other outstanding issues with this, what I think is left is:
Custom blocks as entities.
Passing tests.
Hopefully this is a significant step forward. I'll be working on Custom blocks as soon as this is rerolled against head. This requires the AlterDecorator, which wasn't committed as of the log hash I mentioned. I'll sort these problems out soon.
Eclipse
Comment #51
eclipsegc commentedOk, got a patch that should apply to core now. As a little bit of information that I left out of the last update:
1.) hook_block_list_alter has been removed in favor of hook_block_access which is invoked on a block by block basis.
2.) hook_block_view is not implemented in this patch yet. I should fix that.
3.) hook_block_alter was added which actually allows for the complete swapping of block classes (in addition to anything else controlled by the definition).
4.) There are a handful of changes in the BlockInterface and BlockBase that probably need to move up to the PluginBase.
5.) I've not yet removed the unnecessary tables from the block.install, but most of them will be removed in favor of CMI at this point.
This isn't exhaustive, but it's pretty close. Hopefully this patch is getting closer. Custom blocks are still broken. I'll hopefully fix that soon.
Eclipse
Comment #53
cosmicdreams commentedEager to help on this patch. The issue is difficult to follow but it seems you're close to implementing a conversion example that all of the core blocks should follow. Are we at or past the point where you need an army of folks to go through core and convert all the blocks to the new way of implementing things?
Comment #55
catchWould it be possible to put just one or two conversions in this patch, add a bc layer, then leave the individual block conversions to follow-up issues. I'm concerned that there are #54 comments here, a 219kb patch, and only a couple of reviews since April.
Comment #56
eclipsegc commented@cosmicdreams
All blocks are converted, what we really need help on here it tests.
@catch
Some amount of conversion will be needed in any event (bare minimum we'll need to remove deltas and add a unique plugin id to the hook_block_* calls), but your request might be doable. I'll also have to port in all the CMI change over the existing variable calls. I think what you're asking for can probably be done, but I'd like to hold off on doing it until only that and tests are left to do.
As a compromise would it be possible to provide the sort of patch you've asked for for review purposes only? I know reviewing a patch of this size is difficult, but in this way we could prevent what will likely be a lot of extra work to create a very temporary BC layer? I could provide separate diffs for each module's blocks, and this might make reviewing in general a whole lot easier. Let me know if that sounds workable. I'm happy to break the patch down, but I worry about the amount of work that would be required to build the BC layer.
Eclipse
Comment #57
catchAn API changes-only patch for review purposes sounds good yeah.
Comment #58
cosmicdreams commented#51: annoblocks.patch queued for re-testing.
Retesting because some meat-y things landed recently.
Comment #59
cosmicdreams commented@EclipseGc regarding your point #5 (CMI) . Is the work needed to convert this to CMI apart of this issue or a separate one?
I'm happy to help with that. I'll see if I can find some time to work on tests.
Comment #60
eclipsegc commentedNo, all of the CMI stuff has been done, I was just saying if we tried to build a BC layer for this, that'd be difficult from a variable_get/cmi stand point because we'd have to figure out how to inject config arrays into the BC layer and all of a sudden that gets messy.
@catch,
I'll see if I can break the patch appart into block plugins and api changes this afternoon.
Comment #62
eclipsegc commentedOK, I've broken this into multiple patches. Main patch first:
I've left the system conversion and the menu conversion. Help.module also has a little code in this since it's block is in system, but it's preprocess is in help. The block tests conversion is also in here. Custom blocks are in a separate patch. All other module's code have been moved to separate patches.
Eclipse
Comment #63
effulgentsia commentedWhat I'm most worried about here, from a moving this through the core process standpoint, is that this both changes the API of blocks and the block admin UI. I haven't looked at the patch yet to see how easy/hard it would be to split off all UI changes into a separate issue, but if that's at all possible, I would strongly encourage that. It would help getting the API part of this issue to green, and also not getting bogged down in a 200 comment discussion about UI (we'd still need to have that discussion, but could do so in parallel with using the new API elsewhere in core).
Comment #64
eclipsegc commentedI don't see how we'd separate those. Block UI is completely informed by the API, and an updated api won't working the the existing UI. :-S
Comment #65
sdboyer commenteddropping a note to say i'm pulling this in (at least in part) to facilitate the base controllers work i'm doing.
Comment #66
Bojhan commentedClearly this is not a issue about changing the UI, in that perspective it would make more sense to split it off. Since we cannot give good consideration to the UI at this point.
However given that it was clear from the start that this issue is only an intermediate step, and the proposed UI is close to agreed upon in the blocks & layout discussion - its not necessarily a bad first step. I am at a loss how to move any of this blocks & layout stuff forward.
Comment #67
effulgentsia commentedMerged HEAD.
Comment #69
eclipsegc commentedfixed the whitespace issues in 67, cause that's just how I roll.
Comment #70
naxoc commentedPatch in #69 didn't apply. Here is a reroll. Am I right in thinking that everything is in the patch from #69 or is some of it split out?
Comment #71
podarokbot?
Comment #73
xjm#430886: Make all blocks fieldable entities closed as duplicate of this issue.
Tagging for additional test coverage; I know it's way premature at this point, but if blocks become entities in the course of this issue, we'll want to add blocks to all the various all-entity-type testing (including any I manage to add for #1811684: XSS: Bartik's node.tpl.php prone to XSS (prints $title) which is why I thought to look for this this morning). :)
Comment #74
naxoc commentedWoops. My reroll in #70 only included some of the original changes. Here is a new one that does not trash about half the code.
Comment #76
hass commentedI have not been able to review the patch yet. But could you guys please make sure that a Save, Insert and Update will fire a hook that every module can hook into the process and grab the content inside for analysis e.g. linkchecker link extraction?
Comment #78
eclipsegc commentedGetting working against HEAD again.
Comment #80
effulgentsia commentedGiven Bojhan's comment in #66, I retract mine in #63. The key UI change in this patch (not having disabled blocks immediately visible for dragging on the admin/structure/blocks page, but instead, having to click "Add block" and then select a block from the (new concept introduced by this patch) "Block library")) is logically part of the scope of this issue, because a blocks as plugins architecture introduces a distinction between a "block" and a "block instance", and it makes sense for the UI to reflect that architectural change. If we're willing to accept this interim UI change without bikeshedding it until follow up issues that are specifically focused on UI refinement, then I'm okay with us proceeding with this full patch in this issue.
Comment #81
webchickCan we get screenshots, and an updated issue summary? This patch keeps growing and growing and growing and...
Comment #82
effulgentsia commentedAs I understand it, block instances in general, are configuration, so maybe at some point, will become ConfigEntities, but not fieldable entities. #48 indicates a desire to make *custom* blocks into entities, and this I agree with in principle, but not as part of this issue. That's not yet done in #78, and I'm concerned about adding that to the scope of this issue. I'd recommend spinning that off into a separate issue that's postponed on this one, or whose patches are rolled against this one until this issue is committed.
Comment #83
naxoc commentedThe block config UI gave me all kinds of whack errors so I could not configure blocks at all.
I found two call by reference function calls and removed the &. That fixed it. I have ~E_DEPRECATED on in my php.ini and I think everything went wonky over that with those calls.
Comment #84
eclipsegc commented@naxoc, good catch! Thanks.
@webchick I'll try to get screenshots up here shortly.
@effulgentsia fieldable custom blocks still makes sense here, mostly because unfieldable custom blocks looks totally bizarre in the current patch. I'm open to discussion on that point, but this is what I'm actively working on right now.
Eclipse
Comment #86
naxoc commentedI have been going through the tests in the obvious "Blocks" category for now. A lot of them depend on the custom blocks module, so I have been skipping them for now because that still needs some work.
I have fixed "Blocks -> Administration theme test" so far. Next on the list is the comment block test.
I have not seen ":" in urls before so unless it in unintended in the admin UI I learned something new today. The updated test uses them and it works.
There were other tests that I looked at that failed on db-insertion because the "pages" field in the block table does not have a default value. I added a default of "" to that in this patch too.
Interdiff is against the patch in #78 and so is the actual patch. Let me know if it is easier with another workflow.
The patch still fails a slew of tests so no reason to set it to needs review unless someone feels like that is destroying a workflow. I just feel bad for the bot.
Comment #87
naxoc commentedIgnore the part about the database in #86.
Mysql explicitly manual says: BLOB and TEXT columns cannot have DEFAULT values. I chose to read that too late :)
Comment #88
eclipsegc commentedthe vast majority of tables are actually irrelevant at this point. I'll remove them in the next patch.
Eclipse
Comment #89
naxoc commentedHere is a little more test progress.
I made CommentBlockTest work.
I *almost* made AggregatorRenderingTest work, but it throws an exception complaining about custom_blocks table not existing. I have no idea what causes that, but I suspect that it should not be fixed in the test. So I'll leave it as is for now.
The full patch is kept up with 8.x and the interdiff is an unscientific approach to letting people see what I am altering. It is probably not precise because I just diff my local commits. Sorry for the laziness.
For the aggregator tests I had to fix some small errors in the actual block plugins. If someone could take a look at those fixes in the interdiff and validate that I am not making things up it would be great.
Comment #90
eclipsegc commentedThe changes to the aggregator blocks look super sane to me, my apologies for letting those slip through earlier.
Comment #91
naxoc commentedI am running into a lot of problems with block plugins (the derivative ones) being loaded when running tests - even if the module is not enabled. I tried the
ModuleDecoratorfrom timplunketts patch in #1763974: Convert entity type info into plugins but theDerivativeInterface::getDerivativeDefinitions()gets run no matter what.Some of the plugins run sql queries in
getDerivativeDefinitions()so I get exceptions from the db.I'm not really sure how to proceed. Does anyone have an idea how to be able to run tests without the definitions getting loaded?
If someone wants to test this, then run the "Block caching" test to get an exception from the aggregator module.
Comment #92
dries commentedI like where this is going. Needs some performance testing, imo.
Comment #93
eclipsegc commented@Dries,
Ok, I've left the CacheDecorator off of the plugin discovery thus far for ease of development, but I'll try to get that squared away fairly soon in the hopes of making performance testing possible and reliable.
Eclipse
Comment #94
naxoc commentedStill having trouble running tests at all.
I now copied the idea from
ModuleDecoratorto the already existingDerivativeDiscoveryDecoratorI tried adding the lines checking if the module is enabled to
getDerivativeFetcher(). It does solve my problem but creates new ones down the line inDefaultFactorysgetPluginClass()not finding the class of the plugin and throwing an exception.This is only reproducible in simpletest, so the loading of plugins must be different there.
Comment #95
neclimdulThe loading of plugins can't really be different at any point. The problem with simpletest seems to be that the annotation loader looks at the class loader to find registered namespaces. This is totally reasonable and the right way to handle it but in simpletest its to aggregate namespaces from other tests and the parent site stuff because we're running tests in userspace. This is just a shortcoming of the way simpletest works. We shouldn't special case code to work around simpletest so we'll have to work with some of the simpletest guys to work out how to solve this.
Comment #96
naxoc commentedHere is some more test-progress. Patch is kept up with 8.x (post views commit). Interdiff is still un-scientific.
I got these tests passing:
I can still only create blocks in tests via the UI - I run into the loader problem otherwise. That is not a bad thing per se, but test could probably be sped up some by just injecting blocks. We can always come around to that.
Note that some tests throw exceptions that will have to be fixed in the testing layer. And I totally agree that it would be the place to fix it.
Comment #97
effulgentsia commentedCNR for bot to see what tests are still failing.
Comment #99
naxoc commentedSome more progress. I added some module_exists checks in derivatives see #1821658: Plugin derivatives calling disabled modules in tests - that made it much easier to move forward.
These tests pass now:
About BlockInvalidRegionTest.php: There used to be a warning when a block was assigned to an invalid region. It is not there anymore, so the test doesn't really make sense. But should we still have a warning for that?
I am posting an interdiff for now - I got a merge conflict from 8.x just before bedtime. I'll see if I can clean that up tomorrow. Interdiff is against #86
Comment #100
naxoc commentedHere is a patch that is merged with 8.x
There was a conflict in user.module, but it was pretty straightforward to resolve - it was changes to stuff that is being removed by this patch. If someone could verify that by taking a look at the patch it would be great.
More updated tests to come tomorrow.
Comment #103
naxoc commentedSome more tests done:
I got another conflict merging in 8.x that I couldn't resolve as easily as the one from #100. If someone could have a go at a merge with the patch in #100 and 8.x it would be great. The conflict in the tests (there is one file in tests that conflicts) should just be overwritten by the tests from this patch.
I can upload more patch progress once I can sync up with 8.x again.
Comment #104
tim.plunkettI *think* this does the trick.
#594660: Rename default menu names prefixed all menu blocks with 'menu-'.
Comment #106
naxoc commentedSome more progress. Patch will still fail miserably, but I am getting the number of failing tests down. Marking it for the bot so I can see what I need to work on.
Patch is kept up with 8.x. I had anther merge conflict but it was pretty easy to resolve. It was in bootstrap.inc and came from this issue: #1809206: KeyValueFactory hard-codes DatabaseStorage
I had to change
BookNavigationBlock.phpto avoid an error from common.inc: "@key" is an invalid render array key. I don't like the code in my change there so much, but I made it work. It might need some clarification with comments.I have a list of stuff that is waiting for descisions or me figuring out how to do it. Here is what I have so far:
Comment #108
sdboyer commentedthere's no way i'll be able to penetrate the forest of block reimplementations here. wish i could, but i just can't. so i'll focus on the core architecture, particularly with an eye towards the stuff this is blocking.
when i say core architecture, i mean the family of API-level functionality around the new plugin type that's being created. that's because this patch is tricky: while it's an improvement on its own, it's REALLY worthwhile in the context of the panels-in-core-ish, blocks-and-layouts significant overhaul we're doing. in fact, it's a prerequisite for all of that. it's my hope that if we can just get this patch to the point of not breaking everything for everyone else, then we can get it in quickly so that the other patches blocked on it (#1812720: Implement the new panels-ish controller [it's a good purple] and to a greater or lesser extent #1817044: Implement Display, a type of config for use by layouts, et. all and #1787942: Allow assigning layouts to pages) can roll forward. we're losing valuable time by having to take half-measures in these patches.
architecture review
BlockInterface::accessWrapper()andBlockInterface::access()these methods represent a reasonable approach to block visibility, for the old paradigm: since the block's visibility settings are stored as part of its own internal configuration, it only makes sense that we attach methods directly to the block classes in order to perform those checks. moreover, the separation between
BlockInterface::accessWrapper(), where general block visibility settings are checked (e.g., path or role-based visibility), vs.BlockInterface::access(), which allows each block plugin to also define its own access criteria (and both must pass in order for the block to be visible), is fairly solid - though i have concerns. more on that below.however, at least
BlockInterface::accessWrapper()is destined for the chopping block. when we switch over to a panelsy renderer, a) this data is no longer stored on the block itself, but on the Display, b) we lose the contextual assumptions that allow most of these generic contracts to make sense (since we're ON a display, not in giant globaldom) or at least c) it makes no sense to hardcode them, and we should instead handle that case with condition plugins.BlockInterface::access()is not something we really have in Panels right now, but is probably a good addition. in particular, it is useful because of the thinking we need to do around making blocks addressable: because the access check is tightly coupled with the particular block plugin itself, we know that (at least) this check should be applied to the block's addressable route. it's not clear in my mind whether or not we also would want to include the optional, user-selected instance-specific logic accommodated byBlockInterface::accessWrapper(), but having the tightly coupled access() call gets us a long way.then, there's the set of six methods for configuration form (configure[Wrapper], configureSubmit[Wrapper], configureValidate[Wrapper]). here i start to have a concern about the paired main + wrapper callback. pedantry first: since we're expecting object instances to call the non-wrapper methods from the wrapper methods, the non-wrappers could/should be protected. of course, if they were, then they couldn't be defined on the interface. this points to a basic problem with the interface: it's written with the base class in mind. if we're going to take this appraoch, we should ditch the wrapper methods and have abstract protected methods declared by the
BlockBasefor its children to implement.the last method is
BlockInterface::build(), which is responsible for returning block output as a renderable array. this works fine in the current paradigm, but is really the place where it's clearest that this code is intended to be transitional. without a method that returns a rendered string, blocks can't take their place as first-class controllers in the new routing system. and really, that method should return a symfony Response object, which should also be loaded up with out-of-band data (css, js, etc.) and pass it along that way. in effect, the Response is stepping in for renderable arrays. it'll be better-documented, but slightly less performant. hopefully negligibly so.note - we could retain the build() method at least transitionally as the place where renderable arrays are produced, but add a render() method on
BlockInterfacethat simply translates the renderable array into aResponse.note 2 - given that we are necessarily exploring blocks becoming less...i dunno, blocky, we might consider IN THE FUTURE reducing the scope of this interface so that it better accommodates some of the less traditional blocks - for example, the 'main content' block.
going forward
this patch basically has four parts. i've included a rough % indicating how much of each part is useful in the long term for the new blocks-and-layouts rendering model:
BlockInterfaceandBlockBaseper my suggestions)this patch is stuck in a catch-22. other patches need it in order to fully implement the new rendering model, but this patch needs the new rendering model in order for its architectural approach to fully make sense. this is a big reason why it's dragging, apart from test conversion just being a slog. (kudos, @naxoc!)
what would be great is to set a "good enough" goalpost. nobody is motivated to burn time working on an interface that will be thrown out; we need it to be OK that the interface blows, but that the API is mostly there. that may even entail deleting some tests, then recreating them later in the new system.
Comment #109
sdboyer commented@naxoc - could you please also include interdiffs?
i've added some improved docblocks to
BlockInterface. not all the methods, but some. i actually think they help highlight some of my complaints in #108 :)intentionally leaving on needs work as this was a docs-only change.
Comment #110
jody lynnRerolled for HEAD.
Comment #111
jody lynnI added to the standard and testing profile config that we should have our usual default blocks displaying (search, help, login, powered by drupal, content) in bartik but not in seven.
Comment #112
jody lynnComment #113
jody lynnThis removes the default blocks from the testing profile (we just need them in standard profile), fixes a path in an upgrade test, and fixes the ID in user_new_block.
Comment #114
jody lynnFixes for Drupal\system\Tests\System\AccessDeniedTest to configure blocks properly and not rely on the block title of the User Login block.
Comment #115
jody lynnFixes for Drupal\search\Tests\SearchConfigSettingsFormTest to configure block properly.
Comment #116
eclipsegc commentedConverted the views blocks. This is just an interdiff for simplicity sake for the moment.
Eclipse
Comment #117
sdboyer commentedFixes the Drupal\block\Tests\BlockTemplateSuggestionsUnitTest.
this involved some changes to the way we generate theme hook suggestions for blocks. because it's possible for us to have multiple layers of derivatives (e.g., :::), we now generate incremental suggestions for EACH level, translating
:into__.Comment #118
sdboyer commentedThis removes
BlockUserAccountSettingsTest. Support for this in the code was removed long ago (nobody really uses this...come on). and it's unlikely to translate well into the new rendering paradigm, anyway.Comment #119
jody lynnI had to make a lot of changes in openid because we no longer have block_view_alter.
Definitely needs work on this one to clean it up.
Comment #120
tizzo commentedRemoving unnecessary settings method call.
Comment #121
neclimdullast patch is 0 bytes
Comment #122
effulgentsia commentedPatches in 119 and 120 are incomplete, so this is #118 plus 119 and 120 interdiffs plus an annotation change on BlockPluginUI to set
menu=FALSE, because as TRUE, it was leading to many of the remaining test failures.Comment #124
jody lynnThis gets rid of the change in 119. We should just add in the block_view_alter functionality instead of working around it being missing.
Comment #127
jody lynnEclipse and I found that the change in #122 to menu=FALSE broke the library page.
This patch remove that. We're going to try to fix those tests by enabling block module for them (via sdboyer)
this patch also fixes an aggregator test by removing an unnecessary cache clear and updates a translation test to the new block system.
Comment #128
jody lynnThis fixes the invalid region block tests by implementing handling of blocks in invalid regions in _block_rehash as it worked historically.
To fix BlockCache tests, I had to add a dependency on views to prevent a fatal error on cache clear. Will document in issue summary.
Comment #128.0
jody lynnlink filter to issue
Comment #128.1
jody lynnKeeping list of modules we had to enable within tests to get passing tests.
Comment #129
jody lynnThis is what Sam tried to post in #117 to fix Drupal\block\Tests\BlockTemplateSuggestionsUnitTest
Comment #131
jody lynnFix for the Format Filter Hooks test.
Comment #133
jody lynnFix for Drupal\forum\Tests\ForumNodeAccessTest chasing an upstream change I believe re node access.
Comment #133.0
jody lynnadding comment number
Comment #133.1
jody lynnanother test had to have views enabled
Comment #133.2
jody lynnanother module enabling in a test
Comment #135
jody lynnFixed Drupal\image\Tests\ImageFieldDefaultImagesTest by enabling block in the test. Noted in the issue description and in TODO.
Comment #136
tizzo commentedFixes the views wizard basic functionality test.
Comment #137
tizzo commentedFixing views wizard number of items test
Comment #137.0
tizzo commentedAnother module had to be enabled to pass tests
Comment #138
jody lynnFixed Drupal\image\Tests\ImageFieldDisplayTest by enabling block in the test. Noted in the issue description and in TODO.
Comment #142
tizzo commentedFixed overridden displays tests.
Comment #143
jody lynnAdded more dependencies on block and views modules to fix tests.
Fixed the menu block building.
Comment #143.0
jody lynnAdded another block module enabling to a test
Comment #144
jody lynnCombo of 142 and 143 since we cross-posted.
Comment #144.0
jody lynnMore dependencies on block/views to track
Comment #146
jody lynnMore tests being 'fixed' by enabling block module in tests.
Comment #146.0
(not verified) commentedUpdate comment numbers
Comment #148
sdboyer commentedhad to chase 8.x after changes went in for #1823348: Convert user_block variables to cmi. so, interdiff not really possible.
Comment #151
sdboyer commentedhopefully this will fix MenuTest's 49 fails. it's not behaving in testing on my local, so i really can't tell :(
Comment #155
tim.plunkettBorrowing a trick we use in Views and the Entity API to work around #1780396: Namespaces of disabled modules are registered during test runs, in an attempt to fix StatisticsReportsTest
Comment #157
tim.plunkettThat fix needs to be specific to the block system.
Comment #159
tim.plunkettShould fix
MenuNodeTest
BlockUpgradePathTest
UserAccountLinksTests
Comment #161
tim.plunkettFixed TrailTest and TranslationTest
Comment #163
tim.plunkettOh I rolled this last night but I must have forgotten to upload it.
Fixes UserBlockTests and part of MenuTest.
Comment #165
tim.plunkettThis patch:
Removes the custom derivative decorator
Adds a workaround for #1780396: Namespaces of disabled modules are registered during test runs to DerivativeDiscoveryDecorator that works for all plugins
Provides the block's subject from annotation as the default for the configure form
Cleans up some of the BlockPluginUI code
Removes the unnecessary addition of views.module to tests
Fixes the Statistics test
Removes a hack added to the UserLoginBlock
Comment #166
tim.plunkettLanguageUpgradePathTest and FilledStandardUpgradePathTest fail because placement of blocks is not migrated during the upgrade
UserRoleUpgradePathTest fails because visibility doesn't do anything any more :)
ModulesDisabledUpgradePathTest fails because enabling custom_block tries to create the {block_custom} table while the old D7 block module still provides it.
Comment #168
tim.plunkettWhoops! I guess that fix for default subjects was a bit too far reaching.
While I was debugging it, I also noticed a easy gain in moving the call to block_manager() out of the foreach loop.
Comment #170
effulgentsia commentedPer #81, adding some screenshots. I'm not inlining them into the comment body, because they're large, but am about to see if I can inline them into the issue summary at a reasonable size.
Comment #170.0
effulgentsia commentedMore tests 'fixed' by enabling block
Comment #170.1
effulgentsia commentedUpdated issue summary.
Comment #171
effulgentsia commentedI updated the issue summary. Please update further as needed.
Comment #172
tim.plunkettThe Tools menu should be available to anonymous users, but I'm not quite sure how to accomplish that with derivatives.
Also, removing all of the hacks listed in the issue summary, once it passes I'll update that.
Comment #172.0
(not verified) commentedUpdated issue summary.
Comment #172.1
tim.plunkettUpdated issue summary.
Comment #174
berdirThis means that block.module needs an update function that enables custom_block using update_module_enable(). That function does not install the schema and the then we have a valid state again. Users who don't want custom blocks are then free to disable/uninstall the module.
Comment #175
eclipsegc commentedalso, we'll be removing custom_block module from this patch entirely and filing a critical follow up patch to re-add it. This includes all tests that actually need custom block (as opposed to tests that just use it).
Eclipse
Comment #176
rickvug commentedOne small suggestion after reviewing the screen shots: the local action should include a verb. I found "Block Library" confusing at first glance. How about "Add block from library"?
Comment #177
tim.plunkettRerolled for core changes.
Comment #179
tim.plunkettAttempted to reroll this after #1488630: Who's online block doesn't work with swappable session backends and lazy session creation and #1222248: Remove theme_book_title_link() use l() instead. No real interdiff to provide. But, we now have a branch!
http://drupalcode.org/sandbox/eclipsegc/1441840.git/shortlog/refs/heads/...
Comment #179.0
tim.plunkettUpdated issue summary.
Comment #181
tim.plunkettThis will hopefully fix MainContentFallbackTest and EnableDisableTest.
Comment #183
tizzo commentedFixed BreakCrumb's TrailTest with a commit in the sandbox. Interdiff attached.
Comment #184
yoroy commentedTagging because this changes/introduces UI elements. Exciting stuff! :-)
Comment #185
tim.plunkettOkay here's a patch with a bunch of changes from the sandbox.
Comment #187
dawehnerThe idea to fix the views block tests is to the subject of the views block to "", so it uses the subject generated by the rendered block by views. As config['subject'] is used in the admin listing i think setting a different default in the UI seems to easy way to do it.
Didn't runned the tests locally but i guess this should work.
Comment #188
tim.plunkettNew patch from the branch. Is it possible this might be green...?
Comment #188.0
tim.plunkettUpdated issue summary.
Comment #188.1
tim.plunkettUpdated issue summary.
Comment #190
tim.plunkettRandom fail, but I have a new patch anyway.
Comment #191
effulgentsia commentedOMG! Green! How in the world has this issue not been marked critical before? Doing so now.
Comment #193
effulgentsia commentedI asked for a retest, because locally, I'm getting an install failure possibly due to #1831350-100: Break the circular dependency between bootstrap container and kernel.
Comment #195
Crell commentedI didn't make it all the way through the patch, but here's some thoughts so far:
Why is this in drupal_container, when we're trying to eliminate the bootstrap container? There may be a reason, but it should be documented inline.
Can the config system not be injected here, rather than calling config()?
Geesh. Really, there's no other way than to substr it? Treating a plugin ID as non-opaque makes me squirm. If it's impossible to do otherwise, the reason needs to be documented because I am not the only person who will squirm at that.
I'd much prefer we don't add utility wrappers for things that never had them. We need to be weaning people off of these and encouraging use of the DIC. Step one to that is making it clear that people are using the DIC, so that they can then make the shorter jump to injecting from the DIC.
I must be reading this wrong. It looks to me like we're going to be throwing a lot of exceptions in normal operation here. Vis, trying to fetch an already instantiated object, and if an exception is thrown, then creating the object.
If my read is correct, that's totally not cool and not an acceptable use of exceptions. If I'm wrong, please explain why I'm wrong and what is actually going on here, preferably with additional comments.
Er, why is this utility function needed? What's wrong with telling people to just damned well call methods on the object?
If it's for the alter functionality, that should be baked into the plugin somehow, IMO, rather than dipping back out to a random function.
There's no reason for this to be a db_select(). db_query() is faster.
Ibid.
And also...
zOMG +20 to everyone who's been working on this!
Comment #196
effulgentsia commented1. Based on the pattern for all our other config entities, the config prefix should be
block.blockrather thanplugin.core.block. I'd even prefer justblock, but that might be risky if block.module ever wants to have any config for anything other than the blocks themselves.2. I think it would be ideal to make block configurations into ConfigEntity objects as part of this initial patch. But, if that will require more than a couple days to accomplish, we can make it a critical follow up instead.
15 days to next Drupal core point release.
Comment #197
tim.plunkett@effulgentsia, your first point has a follow-up, and I'd really like to leave that over there: #1839904: Rename plugin.core.block CMI prefix to block.block
Your second point I'd also like to discuss in a follow-up.
@Crell, these are your points I didn't address in this patch:
"Can the config system not be injected here, rather than calling config"
I'm not sure. Not attempting that now.
"trying to fetch an already instantiated object, and if an exception is thrown, then creating the object"
Yes, that's how it works. If you don't like that usage, how would you suggest it change?
Comment #198
eclipsegc commentedNot unless we want to rearchitect everything in the patch :-). This is a mapper, it's intended to have code specific to the use case, and the use case is "here's a cmi key, get me a plugin instance from that if possible". I have avoided config object injection at every point and suggested to others to do the same, it simplifies mocking significantly, and calling ->get() methods on it just return arrays anyway, so this seems really sane and straight forward to me, and this allows for simple array mocking when needing to satisfy a plugin's configuration.
Yes we ask, "Is there a block by this CMI key? if so return it, if not, then expect this to be a plugin id and configuration combination. The same exception is thrown in both cases, if it is NOT a plugin_id/config combo or relevant CMI key. This allows us to get block instances through the same function whether they're mocked or not, and that's ridiculously handy. It also means that things like layouts could store one off block configurations with relative ease. If you have suggestions on this that's appreciated, but it is very very very intentional.
Eclipse
Comment #198.0
eclipsegc commentedUpdated issue summary.
Comment #199
Crell commentedI'm confused now by Tim and Kris's replies. It looks on the surface, and from Tim's comment, like getInstance() is just querying for an already-instantiated object in a cache array somewhere; if that fails, an exception is thrown, and then the object is created instead and added to the array. (I have not verified that's what's actually going on, just that's what it looks like from my not-entirely-deep review.)
If that's correct, then that means a page with 15 blocks on it will throw 15 exceptions in "normal" behavior. That's completely unacceptable; exception throwing is a rather expensive operation, and should by design be reserved for "exceptional", vis. very unusual, situations. Rather, we should do what we do in a few dozen other places in core where we have a static cache and use an isset() check inside a createOrReuseDependingOnWhetherItsBeenInstantiatedAlready() operation.
Based on Kris's comment, however, it sounds like it's for spawning a saved block vs. a created-on-the-fly block. That's a very different situation, but at the same time not an "exceptional" one. In that case, "load a saved block" and "spawn a new block out of whole cloth, with this info" are two entirely different operations and belong in entirely different methods.
If neither of those is what's going on, then I'm very confused. :-)
Comment #200
sdboyer commentedwe discussed kicking most things to follow-ups today, as this thing is blocker to a handful of other criticals. but, until we've actually put those up...
injecting config, rather than calling it internally within the ConfigMapper, is pretty important. i've been complaining about this (indirectly) for some time, because the current approach basically ensures that we're gonna be issuing one query to the config cache for each block that's loaded (since those are inherently single-loading operations). that's just dumb, and we *know* that we need to be more efficient about that.
Comment #201
eclipsegc commented@Crell
$manager->getInstance() calls the aforementioned mapper, passes a CMI key to it, loads that (if it's legit, which most of the time it will be) and then returns a call to createInstance() with plugin_id and conf parsed from the CMI object. If that fails and an exception is thrown, then we assume it's a plugin_id/conf combo, and manually call createInstance() ourself. (Empty arrays are actually valid configuration for things like the powered by drupal block)
Both of these methods call through to createInstance() there are just various levels of logical wrapping around the final execution of that call. block_load() is the central handler for loading blocks regardless of method and is intended to be smart enough to handle all the supported use cases. If it is not, then any logic that needs a block has to first determine (for itself) whether or not it's dealing with CMI keys, plugin_id/conf or some mixture there of (God help it), and in fact, in order to determine that for itself, it will likely have to rebuild EXACTLY this function to determine that. Plugin_id/conf combos are definitely the degenerate state, but I REALLY thing we want to support them, especially given how that methodology can support testing. Separating this logic has non-trivial consequences, and while I'm not opposed to doing it, we should know what it will mean to do so before moving forward on that crusade.
Happy to detail more in IRC or skype or whatever. Let me know.
Eclipse
Comment #202
Crell commentedFrom the look of the code, at bare minimum the exception should be replaced with a far more efficient if-check:
That at least eliminates the unnecessary exception. However, looking at that code I think it becomes obvious why that's a code smell. The D7 registry code that did that was actually one of my slide examples at DrupalCon London for bad code smells. :-)
Calling code needs to know if it's loading a saved plugin by name or an anonymous plugin by conf array anyway, because it needs to know if it's passing in a conf array. If it knows that already, then it's really no burden on it to move that if statement up a level (where such a conditional would have to already exist), at which point this function doesn't have much purpose anymore (aside from potentially being a menu load object for the old menu system).
Comment #203
aspilicious commentedThis patch lacks documentation, some documentation is not consistent and than you have these "no newline at end of file" messages. I know this is an important patch so I'm willing to accept this if there is someone who is going to fix this in the end... (in the best case it would be nice if someone quickly could fix most of the issues in this patch)
Comment #204
aspilicious commentedIsn't this a bug? Shouldn't this be fetching something from the aggregatot_feed table as we are in the FeedBlock class. Seems a copy paste error.
Comment #205
hass commentedHow about "Latest @title feed items" ?
Comment #206
tim.plunkettRerolled because #1827424: Parse annotations recursively went in.
Also fixed #204, it must have been copy/paste.
#205, this is straight from aggregator with no change, please file an issue against aggregator module.
Comment #206.0
tim.plunkettUpdated issue summary.
Comment #207
tim.plunkettRerolled with a fix for standard.profile.
Comment #208
sdboyer commentedcreated a followup for the issues raised in #198-#206: #1842932: Refactor the block plugin type's use of config.
next followup to create is the one regarding the structure of the interface, which i complained about in #108.
Comment #209
tim.plunkettPluginUIBase and PluginUIInterface are completely undocumented, and most of the method parameters make no sense to me.
$plugin and $plugin_id are used almost interchangeably, and I don't think the plugins own ID should be passed to the methods, it's almost never used and getPluginId() should be enough.
In addition, almost every actual block plugin needs a class summary docblock.
I've cleaned up a lot of code, and uncommented out some tests, so we'll see if it still passes.
Comment #211
tim.plunkettWell, it also turned out that custom blocks were broken, and the tests were all removed or not running (the filename didn't match the class name).
I didn't yet figure out how I broke the aggregator tests.
Comment #213
tim.plunkettDefault blocks being loaded were conflicting with the aggregator test.
Also, I tried rerolling around #891670: Add a Footer menu to the built-in system menus, we'll see if that worked.
Comment #215
tim.plunkettWell, it turns out that 350 uses of setUp() have the wrong visibility (it should be protected).
Not fixing them all here :)
Comment #217
sdboyer commentedfixed that one, small new error with the standard profile test...hoping that makes the difference.
Comment #219
sdboyer commentedbleh, rerolled to chase HEAD. hopefully got it all right...
Comment #221
tim.plunkettHere's another attempt at a reroll.
Comment #222
tim.plunkettOkay, I added docblocks for the various block plugins.
The only remaining task is to cleanup and document BlockPluginUI.
Only attaching an interdiff, since they're doc-only fixes. The changes are in the branch.
Comment #223
sdboyer commentedPosted another followup, based on the issues raised in #108: #1850286: Refactor BlockInterface wrapper methods
Comment #224
tim.plunkettRerolled around #1292470: Convert user pictures to Image Field
Comment #226
naxoc commentedThe PluginUIManager was overriding a method as protected, that the parent PluginManagerBase has a public. Made the installer fail. New patch with public method.
Comment #227
tim.plunkettBoth this patch and #1793520: Add access control mechanism for new router system added SystemBundle, that got in first.
Comment #228
tim.plunkettWe crossposted, I committed/pushed your fix and rebased.
Comment #229
mbrett5062 commentedTried to test this latest patch from #228 but failed to apply against latest 8.x.
Here is the git message for ref.
Hope that is of some help.
Comment #230
eclipsegc commentedyay chasing head. Will rectify this once I'm done with my changes to the patch.
Comment #231
eclipsegc commentedOK, didn't have a chance to fix the whole chasing head thing, thought I'd post my patch anyway.
Eclipse
(This should fail to apply)
Comment #233
tim.plunkettI'll post the reroll tonight, and include an interdiff of eclipse's changes.
Comment #234
tim.plunkettOkay, I think I managed to reroll everything. Also, here is the interdiff that should have (ahem) gone with #231.
I'm going to review these changes and clean up their coding standards while this thing runs.
Comment #236
tim.plunkettPluginUIBase makes a lot of assumptions that are currently specific to the Block UI. I've moved those into BlockPluginUI.
Also, I reverted the block_load() changes from the last patch, that caused most of the failures.
Comment #238
tim.plunkettFixed that failure, I think we should be in back in business.
Comment #239
tim.plunkettOkay, I finally sat down and looked at block_load(), and Crell was right, it was the wrong place for exception handling. It should, and now is, handled by the mapper itself.
Also, per @EclipseGc's request, I added a CacheDecorator to BlockManager.
From my perspective this is ready.
Comment #241
tim.plunkettAh, the CacheDecorator pointed out a couple places where blocks are created that the definitions should be cleared. Working on that now.
Comment #242
tim.plunkettAfter digging through that a bit, I've opened #1853190: Cache block plugin definitions.
Currently hook_block_info() is called without caching, the current patch is no different in that way.
Assuming that all of the above fails were strictly related to caching, this should pass.
Comment #243
eclipsegc commentedfurther tagging.
Comment #244
aspilicious commentedQuickly scanned the patch.
Newline needed + some docblocks have a summary that is way longer than 80 chars. But other than that this looks prety good already.
Why are those lines in system.install commented?
Comment #245
xjmGoing to review this monster. I'll inevitably find some docs issues that will distract me from the code, so preemptively assigning to myself to clean them up. ;)
Comment #246
xjmOkay so far I've reviewed only up from the bottom of the patch through the User module. I have questions that are potentially answered elsewhere in the patch or issue, which I'll read after. More after dinner. I'll also clean up some of the things I mention once I get through the patch, so don't bother rerolling just yet. :)
I dig this.
user.access? Is this supposed to beuser_access()? Let's move this@todoto the class docblock.Buh?
I guess we can do this since we aren't rolling unstables yet and one has to nuke and reinstall D8 regularly anyway.
lol
This totally needs an inline comment, or to be factored into a method with a meaningful name.
Interesting. I guess we probably always did this.
So, this is way cool and clean, but it does represent a change in the way block displays get rendered, no? Has there been any profiling around that?
Hm, do we always use these in annotated plugins and I just never noticed before? How unobservant of me.
I am enjoying the concept of
build()callingdestroy(). Is this for memory reasons? Note to self: look this up.Yeah, seeing this over and over makes me think of #1591806: Change block "subject" so that it's called a (admin_)label like everything else on the theme layer. It's like someone grabbed a thesaurus because they were tired of seeing "title". :)
So the IDs are
block_type:instance-name? Why the switch from underscores to hyphens? Wil this be clear to me when I get to the top of the patch and/or read the issue? :)Wait, why does this have a region key in the config if there's also a region in the object name?
Fancy custom configuration key for this block. Nifty.
Looks like quite the naming pattern,
plugin.core.module.theme.region. If we cap module and theme names at 64 each, per #1852454: Restrict module and theme name lengths to 50 characters, that leaves us at a maximum region ID length of 112 characters. (Of course, the API module is always going to be block here, but it's a good reason to not additionally add the owner module to the name in #1776830-13: [META-1] Installation and uninstallation of configuration provided by a module that belongs to another module's API. (We mostly decided not to do that anyway.) See #1186034: Length of configuration object name can be too small.Also, the fact that blocks are storing the module they belong to here as a key is interesting in light of #1776830: [META-1] Installation and uninstallation of configuration provided by a module that belongs to another module's API. We were considering metadata or a manifest file. ...Except, actually, the owner of this configuration is not search, it's standard. Ahhhh! Are there any default blocks provided by modules in this patch?
Why is all this stuff commented out instead of deleted?
Followups
Out of scope for this issue, but it took me like 20 minutes for my subconscious to clarify that this means "exposed filter". At least I think it does.
Hm, why are we removing this part of the coverage? (I haven't read the test; it just jumped out at me.) Perhaps instead of
assertText()/assertNoText()we should add xpath assertions to this test? (That can totally be a followup issue.)Similar here. We're losing a bit of test coverage here, or so it seems. (Also, that comment is way over 80 characters.) :)
Hm. Is there a way we could do this programmatically instead? Could be a followup issue.
Code style crap
Comment wrapping too early, I believe.
Capitalize me. And actually, maybe the comment could be a bit more clear than "get nothing"? :)
Over 80 characters.
Comment #247
xjmFew more notes, up through the top of System module. I'll finish reviewing and do my cleanups tomorrow probably.
plugin_ui? I am experiencing trepidation.
Okay, this answers my earlier question sorta. Why a hyphen instead of an underscore, though? Is it so we can explode
menu-my_special_menuaround the hyphen? I guess that makes sense, but it's kinda ugly, especially when the config object name for these objects already has two other kinds of separators in it.Do I want to know what Plugin UI plugins are? Is this elsewhere in the patch? Is this API that could be added before the patch? :)
Also, I really hope there's a whole lot more documentation about Plugin UI plugins somewhere further up in the patch, and these classes should have an @see to where it's documented.
Finally, class summaries should start with a third-person verb.
Okay, well, this is slightly better than the complete lack of documentation on the interface and manager, however, a lot more documentation would still be a good idea. What is it? What does it mean? Is this a thing like the list controller?
It seems like the interface would probably be the best place for the bulk of the documentation?
This could also use some @see. Finally, the summary should be one line of 80 characters or fewer, with subsequent paragraphs of text after a blank line.
Very decorative.
Nice.
More uncommented explodings, though this one is not as icky as the last one. :)
Hm, the title is changing from "User login" to "Username," or the title is not shown for some reason? Note to self: see what the verbose results on this page are.
Um. This sounds like a pretty big deal for an inline comment and an @todo. That sounds like a blocker.
Hmmmmm. Is the % an argument placeholder? Aren't routes supposed to be in yaml or some thing? Suddenly D7's
hook_menu()looks very attractive.Confused. The role is navigation?
Oh. This is that HTML5 accessibility stuff, right?
Followups
Totally out of scope (it's just context lines in an updated test) but "created unsuccessfully" doesn't make any sense.
Is there an issue for this yet?
Code style crap
Not that this code is hard to understand or anything, but it's slightly annoying when the docblock doesn't say what the hook implementation is doing and there isn't an inline comment either. (I'm cognizant of the fact that this lack-o-doc might not have been introduced here.)
Missing newline.
Verbs the foo bar.
Add s.
Extra blank line. :)
Add s.
Summaries should be one line of 80 characters or fewer.
Comment #248
xjmThere aren't enough tags on this issue.
Comment #249
xjmUp through the Node module. Still not even half done...
Huh. I never knew this was a block, and I didn't understand what it was at first. I think that the block plugin docblocks could, in general, do a bit more to mention what the blocks are and what they're for. "A 'Syndicate' block" isn't entirely clear out of context, and I find myself wondering why we're letting the Syndicate have a block in Drupal. Trust no one.
Yay, xpath! Robust coverage++ But why was this test fixed differently than the other ones that are just asserting that the blocks get rendered?
So this is at least the second time I've seen this, that it's switching from delta to ID. I know that the delta isn't going away from elsewhere in the patch, or at least it still appears to still be there for all intents and purposes. (Or intensive porpoises.) What's the deal? Presumably this will become clear once I read the new architecture. There's also some API change-y stuff going on here that we should make sure gets documented in a change notification. (Presumably this issue will have more than one, since this change is very themer-facing but themers don't care about the stuff we're doing to the base API.)
Why is this commented out? When you comment stuff out, at least comment why you're commenting it out. :)
So, @tim.plunkett pointed me to #1839904: Rename plugin.core.block CMI prefix to block.block and I think that really makes more sense.
plugin.core.blockis a bit superfluous.Why removing this @see? Shouldn't we just update it to reference the new plugin instead?
Okay, so clearly an API change here that I hope I find to be documented when I get to
block.api.phpand the issue summary.Procedural function? Wrapper? Presumably the why of this will become clear as I read up.
Edit, oh, it's a hook implementation. I'll probably have to actually read the patched module to grok this. I guess the gist is, overlay doesn't want all the regions on the page, so we enforce that by conditionally denying access to the blocks from other modules we don't want?
Isn't this really more of a
hook_block_access_alter(), conceptually? Since it's changing access defined by other modules? Or I guess maybe an alter hook doesn't make sense if there's not a different hook that it's altering because the access is in a per-plugin method instead. O brave new API, that has such methods in't.So, we're declaring the admin user as a member variable (missing docblock btw), but we're not actually storing the camelCased admin user as the class member here. I think I saw this elsewhere in the patch as well.
So, coverage being removed here as well, but this totally makes sense; it's not Search's job to test that updating block regions works. I see this repeated in other module's block tests too. Fewer useless assertions++
Hm. If the old block was not cacheable, shouldn't this have some cache settings override as well?
Followups
What is this doing in
testRecentNodeBlock()? It seems completely unrelated. Is it to compare block visibility to a different kind of block than the kinds being tested to make sure Node isn't altering away the wrong blocks? If so there should be a comment saying so. If not it should be moved elsewhere to a method specifically testing per-node-type functionality or removed if such coverage already exists. (The whole test sprawls a bit, but this one especially stood out.)I recognize this is just a stand-in for a custom block that used to be there (since custom blocks aren't implemented yet), but we can open a followup.
Not introduced here (probably dates to Drupal 4.7 or something), but yeacchhhhh. Gahh. Eww. Followup?
Same note as in a previous comment re: a followup to do this programmatically if possible.
So, here,
PollRecentBlock::build()has a dependency onPollRecentBlock::access(), because the access method also sets what the most recent poll is. This makes sense because it has to be the most recent poll that the user can access--a newer one might be restricted--but it's a little weird foraccess()to have any responsibilities other than checking access. I'd open a followup to move the "what is the most recent accessible poll" logic into another method and set$this->record... in the constructor maybe? Or are there circumstances where we want to use aPollRecentBlockobject without retrieving the record? Is there a different method on the base class that fits?Here, the recent block uses the Node module's API to filter the node list to those to which the user has access, rather than the stuff that poll is doing later on (see below). Polls are nodes; why is poll running a special query rather than using the Node module API?
Looking into this can be a followup.
Code style crap
One step closer to standards, but these need docblocks still.
If we're correcting this out-of-scope comment, "log in" should also be two words since it's a verb here. :)
Aside, I apologize for making so many long, unconsolidated posts, but this is just too much to go through in one sitting. When I'm done, I promise to reroll the patch with what fixes I can, actually read the issue summary, and post a TLDR of concerns I have once I have the full context of the patch. :) So please don't bother replying to any of this yet.
Comment #250
eclipsegc commentedyou have nothing to apologize for. I apologize for the size of the patch :-(
Comment #251
xjmAlright, so I've now reviewed everything in the patch except the Block module. Kind of like nibbling 250K of crust off a patch sandwich before eating it.
This seems like another nice prerequisite thing that could go in its own patch and should have its own test coverage, like the plugin UI stuff.
Okay so I still don't quite grok derivatives. I'll try to remedy that before I review the rest of the patch.
iiiiiiiiii-d!
Yay, a freaking comment describing this line! Finally! However, since we repeat this line of code 2000 times and the other 1999 don't have this, add a method to the plugin API or something. I've said this a few times by now I think. :)
So, just an observation now that I've read every module's block integration. There seems to be a lot of variation on where the business logic resides for what get built in
build(). In some cases, as here, queries happen directly in the method. In others, the method calls the module's procedural API to get the data. In one case (Poll), the logic is in the access method. Most memorably of all, in Comment, the logic is in a theme function.It's definitely well beyond the reach of this already-gargantuan patch to sort that out, but we should probably establish some best practices around this, and then later in the release cycle we can clean up core so it serves as a good model for contrib.
On the other hand, maybe part of the answer is "convert as many as possible to Views block displays". :) VDC has mostly focused on page listings up to this point, but there are a LOT of blocks that are ordered, filtered content lists, plain and simple.
Yet another variation of implementing node access for a node-related block. This class doesn't override the access callback at all. Shouldn't it at least check "access content"? At least, the others do.
There it is again.
Yeah okay, we are exposing
plugin.core.blockin URLs too? More motivation to change the prefix. The word "plugin" shouldn't show up for the user anywhere.Why are we undoing some poor novice's doc cleanup here? This is now changing the docblock away from the correct standard to an incorrect format. Reference: http://drupal.org/node/1354#render
I'm not putting this under "code style crap" because either someone went out of their way to make an out-of-scope change from something right to something wrong, or screwed up a merge. :P
So forum does this, instead of what poll does. Note both the fact that the access callback is just
user_access(), and the clever render/query caching.So module-provided menus use the main class, and user-created custom menus are derivatives?
Followups
Is there a point in the summary of that issue referencing this? If not, let's add that.
What on earth is this doing here?
Edit: Oh. I see in the context lines that it's asserting the presence of the help text later. How did that ever work, then?
Also, this is another case where it would be better to enable the block programmatically rather than through the UI.
Okay, that explains that part at least. +1.
Out of scope, but it seems way totally wrong to me for
theme_comment_block()to be not only theming but calling the API function that queries the database to retrieve the comments. The block should get its own data, or the comment module should give it its data, or something, but it absolutely shouldn't be in a theme function... Followup, and/or check whether #731724: Convert comment settings into a field to make them work with CMI and non-node entities is taking care of un-wtfing this.This is changing what this test does, I gather because there are no custom blocks and the actual thing with the filtered text is peripheral to the test... but perhaps we should use a test entity instead, and does it matter that this was in fact testing text filters on non- entities? And what's the purpose of this in
testFilterHooks()anyway? To ensure that the text format can be disabled even when it's used on a node? There should be a comment to that effect (I realize it's the same in the existing test). Can be a followup.Code style crap
Tests.
Comment #252
xjmI cleaned up all the code style stuff from the above, and added some
@todofor critical documentation.I also had to rebase. Bunch of merge conflicts, some from #1843420: Change block test variables - block_test_cache and block_test_content to state system, some from #1849004: One Service Container To Rule Them All, and some in
block.admin.incthat I didn't track down but it seemed obvious we wanted whatever was in this branch.I didn't push my rebase yet in case I screwed it up.
Edit:
merge-diff.txtis nonsense; ignore it.Comment #253
xjmThe way I resolved the conflicts is: in
bootstrap.inc, use 8.x; incore/modules/block/lib/Drupal/block/Tests/BlockHtmlIdTest.php, combine both to switch the variable tostate(), and in everything else, use the sandbox.Comment #254
tim.plunkett@xjm can you push your rebased branch up as a new branch? Thanks!
Comment #256
xjm@tim.plunkett I was waiting for tests to pass and they didn't, so I'm afeared I broke something. :) Edit: looks like
BlockCacheTestin particular.Edit: It's in
1535868-blocks-rebase.Edit: Oh, I misread;
BlockCacheTestdid not have a conflict. So maybe it's not my fault.Comment #259
xjmUnassigning for now in case someone who's already working on this knows right off how to fix the test failures. If you do update the patch, please for the love of Drupal include an interdiff. :)
Comment #260
tim.plunkettI think this should fix the tests (conflict from #1843420: Change block test variables - block_test_cache and block_test_content to state system). Once it passes, I'll push up all the changes to the branch.
Comment #262
tim.plunkettIt seems those lines in the views tests weren't needed. This passed locally.
Comment #265
xjmOkay, round 2 starts today.
Comment #266
tim.plunkettThe 1535868-blocks branch has been updated and rebased!
It reflects the patch in #262 and current HEAD as of this comment.
Comment #267
xjmI went over all the changes to the block module's test coverage really closely to make sure we're not regressing the coverage. Mostly just style questions, though there's some gaps in the test coverage.
This is weird enough that I blamed it to make sure we weren't removing some unexplained coverage for some edge-case bug. It dates to #135464-55: Add language options to block visibility where @Artusamak said: "Rewritting the body generation." Apparently it was to correct a test failure in comment #52 on that issue?, but I examined the diffs and it seems superfluous to the fix. So, long story short, deleting it is good. :)
This is doing the opposite of what the comment says. Furthermore, the assertion is also likely to give a false pass with a malformed result or changed result format; can we assert that
$settingis empty instead? (The previous coverage did not have this flaw, which is why I'm not considering this a followup.) Also typo: "fter".Same typo again, "fter".
Sad panda. Is it possible to use DrupalUnitTestBase instead? How did this work before with a unit test that we have to switch it now?
Edit: is it this container check?
Oh boy. I guess this hints at an answer to my question a couple days ago? Also I don't know what this means. The previous comment, "Hyphens should be replaced with underscores," was pretty clear. How is the expected behavior changing, and what functionality are we testing? I think the main problem is the word "derivative".
Also:
I have read the assertions three times and I don't understand how we're covering all the cases that were covered before.
Is the actual case of the link? It should be sentence-cased...
Also, wait what, I thought the custom block functionality wasn't reimplemented yet based on other parts of the patch that remove references to it everywhere.
Was this feature removed, or has the test coverage for it just gone elsewhere?
Another place that an entire test is getting removed. Presumably related to the lack of custom blocks, but we'll want to make sure this coverage gets added there. We should file a followup to make sure that happens.
Let's keep an eye on #1829224: Convert the 'theme_default' variable to CMI for this (appears elsewhere in the patch as well). Actually we probably don't need to, because the tests will break if that goes in before this, and then we just do a string replace. Never mind. :)
Um, this seems to be empty?
Also, "tests", and there should be a newline between class curlies and the members. But mostly it would be good to actually have test coverage for, like. Basic functionality.
Followups
Yay xpath! Could we get an inline comment here illustrating the expected pattern? (I realize this was an existing assertion but it's gotten less readable.)
Are we using this to simply check that the block appears on all pages? If so we should use the test page to decouple this from node (see #1811804: Provide a test page testing module).
Ideally we'd use a test block than an actual block in all these cases where we're not actually testing this block itself, but this is fine for now. Followup?
Code style crap
Why is this here?
This violates our coding standards; don't we usually use the
<?php if (foo): ?>syntax in templates?This surely wasn't introduced here, but "HTML" and "ID" should be capitalized. Not that the title of a testing module block matters really. :)
Missing newline.
Inaccurate docblock for the file, and missing docblock for the class.
Also, blah blah contains preceding backslash etc., and I think it's supposed to be BlockUITest per our coding standards (not Ui).
The assertion message texts should not be translated. Reference: http://drupal.org/simpletest-tutorial-drupal7#t
Why the extra whitespace?
Needs docblock, and space between it and the next docblock.
Not introduced here, but ID should be capitalized.
Inane observations
Handy.
The overridden assertion message is kinda superfluous here (and elsewhere), but I don't care quite enough to even suggest a followup for it. :)
NULL and not an empty string? Kinda weird.
lolwhat
Next is the actual block plugin stuff, finally. Fun and more fun!
Comment #268
xjmOkay, this is kind of weird. Is this class completely misnamed? I'd expect something called BlockPluginUI to be building a user interface, not merely providing the per-theme derivatives.
Aside though, this particular example helps explain to me what derivatives are for, and might be good to add to the handbook docs alongside the menu block example.
As I stated in a previous review, one inline comment or additional line in the docblock would be nice in cases like this, even though the code is quite simple. It helps learnability to tell someone in words what the bit of code does before they read it.
What a tiny little important class. I find this both cool and scary. :)
Even after reading the handbook docs, though, it still takes a bit to get a clear picture of how this fits together with the other classes that form the Block plugin's architecture (and anyway people should be able to find out some of what they need without going to d.o), so I'd recommend more documentation and @see on this class and its friends to help developers understand how they interrelate. Now, I may be a "self-taught hack" with no CS degree, but I think little documentation her would go a long way to helping people understand the new block system and the plugin system generally without having to do the journey of discovery I did in #1675048: DX: D8 Plugin writing. ;)
Hm, I thought
@Translationdid not work on child keys?This seems like another sort of thing that merits a simple inline comment.
This hints at another API change.
Followups
Minor, but don't we prefer not using "right" and "left" in machine names, since they are typically reversed for RTL languages? Could be a followup, especially if we're planning on iterating on this interface.
So I asked @tim.plunkett why all this facet stuff is in Block rather than the system Plugin UI stuff I already reviewed. He said that he moved it into block because a lot of it is block-specific, and that it's probably better to abstract when we have a second usecase that'd dictate how it should be abstracted, which makes sense to me.
I'm not entirely sold on the whole facet UI pattern, either generally or as it appears here. I think it's a pretty complicated interface pattern for core (...er, please pretend for a second I'm not involved with Views). ;) I personally even have a little trouble understanding the interface when I look at it.
Bojhan came up with a design to solve a similar UI task in Views that I think is a reasonable first step:
#1832862: Make views add field scannable In that mockup (and the current Views UI for that matter), there's similarly a search for a particular use of a plugin, a filter by a module facet, and a large result set. If we go that direction for Views, we might want to consider something like that here, so that people recognize the same interaction, or otherwise standardize the two somehow. (There's some third usecase that's similar that we discussed at BADCamp, something layout-related I think.)
All that said, I do NOT want to block this issue on a UI discussion. I am strongly in favor of putting in a rough, functional UI and then iterating on it.
The one thing that does trouble me for the current patch is the lack of explicit test coverage. A couple parts of the UI are tested implicitly in almost every module's block tests, but the rest is untested, which makes me nervous, especially given that there's a pretty complicated UI brewing here.
Code style crap
Block, block, block, Drupal chicken. Tim showed me this example in Views where we do not use the (admittedly more numerous) decorators all inline:
http://drupalcode.org/project/drupal.git/blob?f=core/modules/views/lib/D...
Yay documentation! These should have a one-line summary above any extended description paragraphs, though.
We should alphabetize these or something after the standard ones like ID and module. I'm having trouble scanning the list to identify a particular key.
Inane observations
I made it to the interface!! Finally! I feel like Mario when the princess is finally in this castle, or maybe Frodo at the base of Mount Doom.
Time for a glass of wine; more later.
Comment #269
xjmAfter talking to @EclipseGc awhile about previous comments, I realized it would be more helpful if I offered examples of the sorts of minor documentation additions that would make the code easier to follow, rather than pointing out over and over again that they were missing, because apparently it wasn't as obvious to Kris as it is to me what was missing. The last couple comments about missing documentation here were before that conversation, because I review code from the bottom up. ;)
...Oh. It does still exist? Mmm, why is it being removed everywhere then?
That said, I do see how it could make a lot of sense to have this in its own module, à la Views UI or Field UI. Not sure about the directory structure. Field UI is on the same level as Field. Views UI is inside Views, but we have a postponed issue somewhere-or-other to move it up to the parent level as well. Thoughts?
Haven't reviewed the custom block code yet; going to paste my review before my browser crashes or something.
There are no
getConfig()orsettingsWrapper()methods on the interface. I just read it like three times. :)Missing a docblock.
Maybe add a docblock paragraph, "Creates a generic configuration form for all block types. Individual block plugins can add elements to this form by implementing BlockInterface::configure()." (That is, if we want to keep this pairing of
configure()andconfigureWrapper().Also, this is kind of sprawling. Maybe worth breaking it up a little, as is suggested later in the method.
Add a second sentence to the docblock (after a blank line), something along the lines of: "Adds the user-configured per-role, per-path, and per-language visibility settings to all blocks, and invokes hook_block_access()." Also an @see to hook_block_access().
Add an inline comment above the return, something like, "By default, the block is visible unless user-configured rules indicate that it should be hidden." If that's accurate.
So the block ID (machine name) length is 64. That's a good thing, given these issues both with MyISAM and with config of keys butting up against limits (see my first review comment). Is this length also enforced on save? What about the database; is this the size of the field? This is an important enough restriction that we might want to put it in a constant.
Add an inline comment, "Add specific configuration for this block type." or something along those lines.
Penny for a code comment.
Bit thin. This would be the place, if any, to wax melodramatic about what block plugins are, and explain the architecture in detail.
Also, blahblahblah, verbs.
Okay, yay, documentation. Still don't understand why
accessWrapper()has the word wrapper in it. This dichotomy also doesn't exist elsewhere in our access control APIs. Maybe the need for it will become clear when I read the base class, but for now at least it strikes me as an architectural oddity and awkward DX. (Also, "contracts"?)Also, minor, the return value should be documented, e.g.: "TRUE if the block should be shown, or FALSE otherwise."
Edit: So I got up to the base class, and it looks like perhaps the two methods are a way to always add the generic, user-configured visibility settings without having to call
parent::access()all the time. Is there a usecase for overriding the base implementation ofaccessWrapper()? If not, maybe we can change the architecture somewhat to make it clear thataccess()is the only method individual block plugins should probably care about. I guess the same is sorta true of the form stuff.Looks like this docblock was unfinished. Also, if it's the "full form for block configuration," then why is it called Wrapper?
Needs documentation for the parameters and return value. Also, it would be good to clarify how this is related to the "full form".
So uh. The docblocks for these are the opposite of the functions; the ones that say "wrapper" in the docblocks don't say wrapper in the method name. Also what is a "wrapper" in this context? A wrapper function (and why would we put that on the interface)? A stream wrapper? A markup wrapper for rendering? Tinfoil? Holiday paper? Queen Latifah? Especially on the interface, the docblocks should say what the thing does, not just repeat the method name in sentence form.
Also, code style things: blah, summaries should start with verbs, yada yada. If they were procedural the standard would dictate that the docblocks be in the format "Form submission handler for foo_bar_form()," but as previously stated this is a brave new world (that has such methods in't) so for now just verb it up. For the same reason, we should probably add parameter documentation for $form and $form_state. Presumably there isn't an expected return value.
Followups
Do we have a followup yet for this?
Does this have a followup issue yet?
This is way out of scope, but core is pretty inconsistent about whether access is additive or subtractive. In this method, and in the hook invocation, it's subtractive. IIRC field access is also subtractive. Node access is additive. Etc.
Needs a followup.
What would you think of having each kind of check in its own method? (Just on the class, not on the interface.) So then we'd have helpers BlockBase::roleAccess(), BlockBase::pathAccess(), and BlockBase::languageAccess(). Just a thought.
Code style crap
Should have a one-line summary of 80 chars or fewer that starts with a verb, with additional detail in subsequent paragraphs. Maybe something like:
Verbify.
This seems unnecessary, since it is FALSE by default. We could either remove this, or return FALSE here.
Comment #270
xjmAlright, reviewed the Custom Block module. Nice to come back down (or climb back up?) to earth a bit. :)
Huh? That's kind of weird. I don't get what this is.
Sentence case. We reserve Capitalized Words for things that are proper nouns, like module names. Operations are sentence case.
Mmmm. Maybe I'm missing something, but it looks here like we can edit but not delete them? Edit: Unless you can only delete from a button on the edit form? #1834002: Configuration delete operations are all over the place
This also probably wants to be replaced later with dropbuttons, maybe a list controller or administrative view depending on whether we want to call this content or config.
IIRC we usually add the "Add one" link in here for usability. (List controllers do not right now due to an outstanding issue, but since blocks aren't config entities and aren't using the list controller, that doesn't apply here.) ;)
This is a bit awkward. How about: "Allows the creation of custom blocks through the user interface."
Seems to be missing a
hook_uninstall()to delete its table and clean up its data.Glad that there's a comment. However, translation please?
Aha, found it at last. These should be sentence case.
Maybe "Retrieves block definitions for all custom blocks" and "Defines a generic custom block type" to make it easier for people to understand the relationship between the plugin and its derivatives?
Add a paragraph to the summary, e.g.: "Retrieves custom block definitions from the database." If that's accurate.
Okay, this is a little confusing. I thought (based on the plugin's configuration form) that
'info'was the key for the administrative block definition, but he're we're using it for the user facing block title?Inline comment explaining why we need to unset this would be good.
Add an additional paragraph to the summary: "Adds the user-defined block body and description for each custom block to the block's configuration." (If that's accurate.)
Add a paragraph to the docblock: "Adds body and description fields to the block configuration form."
So I thought that elsewhere, we have the
accessWrapper()andconfigureWrapper()and whatever to avoid having to callparent::whateverCrap(), but here in this class we're doing so anyway.Followups
Followup, make it an entity of some flavor. Did I say that yet?
I'm starting to feel like I've seen this before. Is this exactly the same as all other implementations of this method, just a wrapper for the multiple getter or retrieving it from the object if the list is already set? Would it make sense to abstract this and provide a BlockDerivativeBase, or is that a completely dumb idea with this architecture? (I honestly have no idea, outside of the programmer knee-jerk "saw the same thing twice, refactor.")
Look, it's my favorite explosion again.
Really, we're calling
drupal_write_record()here? So for now at least, custom block storage isn't swappable. Maybe a followup? Maybe custom blocks are entities? (Content entities? Config entities?)Still have to review the procedural block module code and its API docs. Getting close though!
Comment #271
xjmArgh, lost a review post. I'll try to recreate it.
Comment #272
xjmNice. This probably needs a docblock update too. The diff is a little weird. So many deleted lines, yay.
Parameter documentation for this needs an update.
Hmm. Is this for deleting custom blocks, or removing block instances? We should probably clarify the text and documentation a little in that regard. The form builder also needs to have its parameter documentation updated.
This mostly looks pretty good; however, can we use closer-to-reality examples that will illustrate the difference between
NAMEandIDis?Also, if we're not calling block deltas "deltas" anymore, then that word should also go away elsewhere. (I think I mentioned this before.)
Maybe we want to do this conditionally, based on whether or not the site has any custom blocks defined? (This is a question we still need to decide for Views, as well, and possibly worth its own separate followup discussion.)
Should this be in
custom_block_help()instead?I'm glad there's a comment here, but it's still clear as mud. :) I think what we want to say is something like: "Define an administrative path for each block plugin in each theme" or something. Right? and an example of what they look like in a subsequent comment would be ducky.
By now you know what I'm going to say here.
Seriously. If we keep leaving food out for these string manipulation sequences all over the place without controlling the population with sensibly abstracted class methods or at least the occasional inline comment to keep an eye on them, they're going to overrun our cities, then evolve intelligence, become self-aware, and take their revenge. Do you want to think of what beings who grew out of
explode()andarray_pop()andstrtr()would do to living tissue? Me neither.Er. By which I mean, see #1760358: Provide a way to extract the ID from a config object name. :D
Ghosts! XML? :) Also, this is way weird. This function doubles as a load function and as a create function? Do we normally do that? Hmmm... entity_load() doesn't, but Config::load() does.
All this with block having its own one-off CRUD feels SO D7, but that's followup-land. ;)
Okay, interesting.
Here, the string manipulation is building the template for the hook name, so that makes sense to me. The code comments explain what the string manipulation is doing in this case, and it's specific to invoking the hooks, rather than being something that's a pattern we need to use over and over.
Yay comments! A method maybe? Related issue: #1701014: Validate config object names.
Yeaghhh. At a minimum this should have an inline comment.
Also, does the while loop mean that derivatives can have derivatives?
Hmm, more "eesh". Related: #1760358: Provide a way to extract the ID from a config object name, #1760358: Provide a way to extract the ID from a config object name
I find myself pondering whether block should actually be invoking this hook. Menu is the module providing the menu block plugin. (And then, too, the eventual shape of this will depend on what happens with menu conversions to configuration and/or entities.) Note to self: look up those issues.
See #1776830: [META-1] Installation and uninstallation of configuration provided by a module that belongs to another module's API. I think this should be the Configuration system's responsibility, not Block's; otherwise, we're going to end up repeating patterns like this over and over. (Note that the point does not have consensus in that issue.)
This case is interesting because, unlike Views, this configuration is not created with ConfigEntity. It gets us into the weird DMZ between ConfigEntity and the plugin system.
So: Need to double-check that there's test coverage for this. I half-remember asking something related to the language/block integration tests back in the Dead Marshes.
Followups
We are removing these hooks entirely? That's another pretty stark API change. Or is it a followup to reintroduce them? CRUD, entities, etc.; merits a followup discussion.
Aha, two questions of "who calls this?" answered in one snippet, both the access wrapper and the block hook invocation wrapper.
Kind of a weird little underscore-prefixed procedural wrapper for a procedural wrapper for the OO code, but that makes sense in a conversion like this. Maybe wants a followup, depending how it's used. Note to self: look up callers for this.
Again with the weird underscore-prefixed procedural wrappers adding a bit of logic around OO code. Something else to look up.
What a weird function name. Another one to look up.
AHHHHHH MY EYES BURNING THE BURNING
@todo should be at the bottom of the docblock; also, is there a followup issue for this?
So, interesting. We're expecting it come in as a render array, but there's no typehint, and we're deliberately making the array empty if the block isn't accessible, even if it already had stuff in it, which the previous code didn't do. Maybe there should be a followup to add a typehint.
So this is where per-user block customization used to live, I think. I haven't seen it reanimated yet anywhere. If we're removed that functionality deliberately, it should get its own, separate change notification, or a followup issue if we're planning to add it back.
Code style crap
We should probably say "configuration object name" rather than "CMI key". CMI is a Drupal 8 initiative tied to this release cycle, but configuration objects are forever. Like diamonds.
The definition of id is:
(
s/\<id\>/ID/g)Verb.
And... http://www.youtube.com/watch?v=n9D7oeM3zd8
Now I'll roll in what cleanups I can from the second half of my reviews here, and then, dare I say, read the issue summary and maybe some of the comments. ;)
Comment #273
xjmI rebased the branch for latest 8.x HEAD and re-pushed. One small merge conflict from #1811828: Use #attached to find the css/js of a view (see attached).
Comment #274
xjmFrom #1798872: Convert admin_theme to CMI.
Comment #276
tim.plunkettReroll! Will update the branch if this is green.
Comment #280
xjmNote to self: do not attempt to roll patches at what would be 3:00a your local timezone.
The fails are likely from #1811828: Use #attached to find the css/js of a view, though. I will consume coffee before trying to fix them, so that I fix them in a way that is not nonsense.
Comment #281
xjmWhat this patch contains
BlockInterfacedefining block configuration settings, configuration forms, access control, and rendering.BlockBaseimplementing the interface for a base plugin, with default settings, form handling, and access control.block_build()procedural wrapper for invoking block view alter hooks.BlockBundleto add the block manager to the container.BlockManagerto locate and instantiate block plugins.DerivativeDiscoveryDecoratorfor #1780396: Namespaces of disabled modules are registered during test runs.ConfigMapperclass that creates a plugin instance from data stored in the configuration system.hook_block_info()andhook_block_info_alter()with annotated plugin discovery.hook_block_configure(),hook_block_save(),hook_block_list_alter(), andhook_block_view()(but nothook_block_view_alter()).hook_block_view_MODULE_DELTA_alter()renamed tohook_block_view_ID_alter()hook_block_NAME_alter().hook_block_access().hook_block_alter().Comment #282
tim.plunkettOkay, I should have fixed the Views failures. I ran this interdiff by @dawehner, he approved :)
Comment #283
xjmI added all the minor code style cleanups listed above. There's still a lot of work to be done on the documentation here, and I'll work on that more later.
Comment #285
xjmAhem.
Comment #287
jibranno need for
strtr.drupal_html_idreplace _ with -Comment #289
xjmComment #290
mbrett5062 commentedPatch does not apply against latest HEAD.
Sorry can't do anything more to help out ATM.
Comment #291
tim.plunkettUgh, same issue as before, just a follow-up now. So rerolled for #1798872: Convert admin_theme to CMI.
I also addressed the bit from #287, thanks @jibran.
Comment #292
mbrett5062 commentedOK very quick observation. More to follow tomorrow.
On 'Blocks Library' overlay, the search field is way to long, and not responsive in anyway. Remains the same length regardless and runs off edge of form/overlay.
Comment #294
xjmThis post and attached patch brought to you by a sprint, a couple transatlantic flights, and, well... https://twitter.com/tmplunkett/status/277882392331558913
Patch scope
So, the first thing I have to say about this patch is that it's obvious that tremendous effort has gone into it already. Seriously, wow. Thank you @EclipseGc! Thanks also to everyone who sprinted on making tests compatible with the patch, particularly @tim.plunkett for keeping it from dying in the reroll graveyard and being (mostly) patient with my rants about this issue. ;)
Corollary: The patch is huge. I'm not just griping; I think this patch is rather monolithic for our processes and almost unreviewable. I've talked about the process issues surrounding this patch with a number of people over the past couple weeks. While I think it's mostly too late to split this patch up, especially now that so much effort has gone into migrating tests, here is what I think would have made this patch easier to manage and helped it get in sooner, for future reference if nothing else:
A sandbox from the beginning, with interdiffed patches to track progress periodically in the issue. Rerolling this patch is frustrating, because every day or so a core commit breaks the same massive initial commit from comment #179.
A backward compatibility layer with an independent test implementation for the new API. It would have been more work initially, but it would also have made earlier patches reviewable and "on the radar" with passing tests. Then, we could have followed up with a conversion meta, like is being done for CMI, EntityNG, etc., so that each conversion could be reviewed independently.
The basic API for the plugin UI could/should have been added before this patch in a separate issue, again with its own test implementation. (Similarly to how VDC added the list controller before Views was merged into core, though with a bigger scope.) I realize that the old UI is totally coupled to the old API, but with a sandbox (as per #1), work could have proceeded while PluginUI was undergoing its own review.
The ConfigMapper could similarly have been added on its own before the main patch, again with a test implementation.
The facet stuff could be added separately in a followup issue. (This we might still be able to do.)
For the Node frontpage conversion, VDC also opened separate issues to decouple tests from the listing. There aren't too many of those here, but it would have been a way to make the patch smaller.
At this point, I guess a solution is to get this patch as close to ready as possible, including writing a lot more documentation, and then file a ton of followup issues. I've already talked to @tim.plunkett about some of them, and I'll try to help by filing more from some of my own comments above. There are a couple problems with this approach, though:
Ultimately, I think we will probably need committer feedback on where to go from here.
Actual review
Architectural observations
I'm going to file a bunch of followups based on my posts above, but here's my thoughts on the architecture introduced by this patch:
The plugin UI stuff seems odd and awkward to me, both the code and the actual UI. Tim promised me a followup, though, and we hope to replace most of the user interface anyway with layout building stuff, so I'm not going to complain about it more right now.
The wrapper methods on the interface made sense once I read the base implementation, so I tried to clarify the documentation; as Tim put it, it improves DX for block plugin authors by making the interface and DX for callers a bit odd. That's a good tradeoff since the first case is going to be far more prevalent.
The configuration form ones are mostly necessary, since the
parent::configureWrapper()needs to add to the form structure both before and after the specific form elements. The access one is less of a requirement, though still probably sensible since child implementations would all have to check the generic logic after their own logic rather than before (at least given the current access logic).Whether or not these wrappers should be on the interface, or a different interface, or just the base class is worth clarifying, since
settingsWrapper()currently is only on the base class.Also (from #269):
The way the interface methods are used within the block module is also probably worth another look. E.g.,
block_load()adds some logic rather than being a simple procedural wrapper._block_load_blocks()and callerblock_list()also have their own, important logic._block_rehash()does a bunch of stuff that seems quite important for such a weirdly named little function, like handling disabled blocks, block regions, etc. This stuff probably happens elsewhere as well, and probably should at some point be refactored; there's a bit of code smell. Maybe the place to iterate on that will be when we get to placing blocks in layouts and such.The stuff I said in #251 about the relationship between the
build()andaccess()methods, especially with the core implementations in the current patch. Quoting to save some scrolling:See my remarks in #246 about the naming of block plugins and their configuration objects. There's #1839904: Rename plugin.core.block CMI prefix to block.block and #1760358: Provide a way to extract the ID from a config object name and all the issues I mentioned about configuration object name length, but that doesn't cover all my questions or all the kinds of name matching we're doing. E.g.:
Something in the plugin system should have methods for retrieving the plugin and derivative IDs from the compound ID (i.e., the exploding around
:). This would make the code more readable, grokkable, robust, etc. Also, I believe most of the string manipulations I saw assume only one colon, but I think it's possible for derivatives to have derivatives, or something? Like, a custom block or a menu block is also placed per-theme. (See more below in point #9.)Similarly, the use of the hyphen in block plugin IDs/names/deltas/whatever is undocumented and untested, even though a lot of code has certain expectations about it. I'm not sure if the usage of the hyphen is the same for (e.g.) Views blocks and Menu blocks, but we should clarify and also add methods either to the specific plugins or to the base plugin, as appropriate.
We should also throw an exception if a block machine name length is over 64 chars, rather than just counting on a FAPI
#maxlengthto enforce that.String manipulations for template name suggestions, alter hook identification, etc. might be specific enough to not need their own wrappers, but they should at least be clearly documented and tested.
I have related thoughts about the ownership of default block instances and which system is responsible for installing them, but I'll come back to that later because I am actually knowledgeable about that and I want to think about it more and I am also sick of looking at this right now. :)
The bit in
system_menu()is yucky. I don't think this is necessarily Block's fault, but if it isn't, I sure hope it's a side effect of WSCCI routes stuff being a work in progress, rather than a terrible DX regression. And if it is Block's fault, let's at a minimum get some code comments and perhaps rethink how we define and map those menu items.The Custom Block module has a few issues:
hook_uninstall()to clean up its data.Related observation: As far as I understand (and I now understand much better), the block system uses derivatives in three ways so far: to create per-theme instances of blocks, to create menu blocks for each menu, and to create custom block derivatives from the users' custom block records (hopefully entities some day). It might be good to explicitly test the interaction between these patterns to ensure that we handle (e.g.) per-theme per-menu menu blocks correctly.
Also, what about placing the same block in the same theme twice? Does the API support it? Is that targeted for a followup issue?
Finally, when I mentioned the lack of documentation for derivative classes to @EclipseGc, he said something to the effect of "well I didn't really think it needed comments since it's the same pattern over and over" (re: fetching an individual definition, perhaps?). If the same pattern is repeated, should that pattern be abstracted? (The answer might be no.)
Hopefully my post in #281 can be a table-of-contents for others to review the patch's architecture. (I'll add it to the summary once I have someone friendly check it to make sure I'm not talking nonsense.) As an overview, here's what I'd suggest having not-me review (by priority and in nice topical chunks; you're welcome):
BlockInterface,BlockBase,BlockManager, andConfigMapper; along with at least one of the module-provided block plugins and one of the exported YAML files.Changes to
block.moduleandblock.admin.inc.Following 1 and 2, the whole of the patched
block.api.phpto check its accuracy.PluginUIInteface,PluginUIBase,PluginUIManager,\Drupal\block\Plugin\system\plugin_ui\BlockPluginUI, andDrupal\block\Plugin\Derivative\BlockPluginUI. (Keeping in mind the followup for improving it that @tim.plunkett said he would file. I don't know if he filed it already because I am flying over a glacier.)The custom block module, in whole.
API changes
There are more than a few.
API changes we know about should be added to the summary like, nowish, so that people have a starting point for reviews and so that writing the plethora of change notices this patch will spawn is not so daunting. E.g., in addition to the changes I identified in #281, the structure of the block render array is being changed. Those ArrayPI changes should be documented as well, probably separately since they are directly relevant to frontend developers.
I'm ambivalent about the removal of those several hooks. EclipseGc becomes rather animated when talking about removing them, but I'm not convinced.
I'm somewhat less nervous about the removal of user-specific block visibility settings, because it does seem to me like it might be more of a contrib thing, but it is a regressions and I am pretty sure we will frustrate some people if we don't have a followup to add it back.
There's a lot of goofy procedural cruft in the Block module yet, but I think cleaning that up is out of scope and probably best as a followup issue. Please file.
Test coverage
Overall, most of the minor issues I've identified with the tests in my numerous posts above can be resolved as followup issues. However, there are the directly relevant gaps in test coverage:
The Custom Block module should probably have its own tests. Some tests for the previous functionality were removed from the parent module's tests, and some is still kicking around but should be moved so that we can make sure the coverage is complete.
The UI is untested. One or two specific elements of it are implicitly tested by all the core module block implementations, but
BlockUiTestis empty and the generic implementation insystem.moduledoesn't even have an empty test class. They should both be tested with decoupled test implementations.The ConfigMapper and general block storage are also untested, except perhaps implicitly. This is important because the only thing of comparable complexity interacting with CMI is Views, and Views uses ConfigEntity to handle CRUD and storage, whereas blocks do not. See #1776830: [META-1] Installation and uninstallation of configuration provided by a module that belongs to another module's API.
Several specific implementations have reduced test coverage, specifically
OverrideDisplaysTest,BlockTemplateSuggestionsUnitTest, and I think others that I scanned without commenting on. The coverage inFilterHooksTestis also being changed, and IIRC numerous tests have had coverage relating to custom blocks removed.Test coverage for user-specific visibility settings is being removed, because the feature is being removed.
Note: I thought before that
BlockLanguageTest::testLanguageBlockVisibilityBlockDelete()was being removed, but actually it's just being moved, which I wouldn't have realized if I hadn't tried to make up a new simpletest assertion. (Thanks @tim.plunkett for catching that.)Documentation
I took a stab at adding some docs myself (attached), and I've tried to add @todos for all the places I think more documentation is needed. Please iterate on what I've added. Improving the API documentation will make it easier for people to review your patch. In general, I shouldn't have to parse and execute PHP in my brain to have an overall idea of what something does. This patch adds a lot of new classes, and even if those classes follow smart-people design patterns and are just implementations of existing APIs and la-ti-da, they should have some minimal documentation that explains in plain English what they do and are. A sentence or two goes a long way. Furthermore, there is nothing whatsoever in this patch that explains the big picture for the new blocks system, and there should be. The main interface is probably a good place to add that.
Upgrade path
It's, um. Missing. Yeah. Um. Yeah.
@tim.plunkett explained to me that the plan is to add the upgrade path once some of the followups are resolved, since otherwise the upgrade path will essentially be written twice; and that core committers (catch? webchick?) are on board with this. This makes me nervous, especially given all the hell we're going through in Views to install a simple frontpage View on upgrade, but given the scope of the existing patch and what a PITA it is to chase HEAD for it anyway, I can understand how it might be the better strategic decision.
Stuff I didn't review
I didn't manually test the patch at all, mostly because I really think of it as a stopgap interface, and I think EclipseGc and others do as well. I might test it later just to get a list of Even More Followups™, but I am afeared certain people will be cranky with me if I harp on that now. :)
I also wonder if anyone has benchmarked anything related to this? (The answer to that might be in the 200ish comments before I started looking at this issue, and I apologize if so.) It might not be worthwhile yet for the same reasons listed above, and also because it might show out-of-scope regressions related to the same subsystem performance issues Views is facing (class loading, config system I/O, etc.).
Phew, okay! I think that's all I have to say for now.
Attached patch
My reroll here:
Adds some docs. I'd appreciate it if someone knowledgeable (Tim? Kris?) could review my interdiff and make sure the documentation I've added is accurate.
Adds
@todosfor adding more docs. Every@todoin this patch should either be fixed or have an explicit followup filed before it goes in, and I think the documentation should be added ASAP so other people can review the patch more easily. If someone wants to work on writing some of the documentation I've indicated, I will help you refine it.Corrects a couple strings to sentence case, per my earlier comments.
Makes one updated test assertion more robust (as per an earlier comment).
Further simplifies the logic in
BlockBase::accessWrapper().I've pushed these changes to the branch as well.
I'll read the rest of the issue and file some followups at some point, but not today. I need a break from this issue and I've lost track of everything going on elsewhere in core. :)
Comment #295
mbrett5062 commentedNot sure if anyone will find this useful. I have extracted an index of the files (with patch line numbers) from the patch in #294. It may be of use for someone looking to split the patch, say moving conversions into separate patches to allow for easier review.
Comment #297
xjmHere's all the @todos in the current patch.
Comment #298
xjmAlso (more tags!) the current issue summary for this issue is very out-of-date. I'll try to help with it later.
Comment #299
berdirNote: The last todo about the statistics block is not introduced by this patch, just moved, might be similar for others as well.
Comment #300
berdirCrosspost. And comment #300...
Comment #301
xjmFortunately some clever elf deleted a bunch of System Message posts. ;)
I finally read through the whole issue. I didn't give @naxoc enough props earlier; awesome work on the tests here. I also saw that some of my questions were raised earlier by others, which is reassuring; @catch and @effulgentsia raised several of my concerns about process here a couple months ago, @tim.plunkett shares some of my concerns about the PluginUI architecture, and @sdboyer has a very helpful review in #108 about the wrapper methods. @sdboyer and @tim.plunkett have also filed several followup issues that are not listed anywhere. Edit: Except now, below.
#117 also confirms one of my thoughts above in #294:
That wants to be tested.
Meanwhile, here's (I think/hope) all the other issues linked in comments above. Some are followups, some are directly related, and others are simply related to points brought up during reviews. Edit: I moved these to the summary because of persistent confusion.
Other notes:
hook_block_access()andhook_block_alter().Looks to me like they're still there? Like, the summary is selling "no more
{block}table" but it's totally still in the schema. I don't know which, if any, are still needed. Let's at least delete tables that are no longer used, including adding an update hook for deleting them?Comment #302
tim.plunkettI think the new approach is to add them to #1860986: Drop left-over tables from 8.x and leave them in code for now?
Comment #303
tstoecklerRe #302: That issue is for dropping tables on update so that existing sites don't have unused tables lingering around. Because arbitrary contrib modules may still join on the {block} table for example, I think we decided we would remove those tables only in Drupal 9 to give contrib a chance to catch up. For new installs, though, it is pointless to create tables which are not needed. So the table definition should definitely be removed from hook_schema() and the table should then be added to the list of tables in #1860986: Drop left-over tables from 8.x. The update function should not drop the table.
Comment #304
catchtstoeckler's exactly right in #303 on the tables. We don't know what data modules might be referencing the block table from and it doesn't cost anything to leave it in people's databases for a release - sites who care can drop tables themselves (or use migrate to update anyway).
It'd be good to get a better idea of what the major follow-up work is that follows this patch, and also any issues that it's blocking (these might be the same thing), i.e. what remains to get this into a sane state that we could release with. #301 is a good list but that all looks like clean-up rather than next steps.
Comment #305
xjmOkay, but the
hook_schema()is still wrong, though. :)Comment #306
xjmEr, did you read #294? =/ #301 is basically just collecting notes for an issue summary.
Comment #307
webchick#294 and friends is pretty sobering. Thanks, Jess, for taking the time to write that up, as well as your other fantastic reviews. Unbelievably helpful.
So this issue has now been in progress since April (I think actually before April since it started in a sandbox, afaik). We're now in mid-December, which is well past the original feature freeze deadline, and we're still essentially at "needs work." It seems like there's still a long way to go on this particular patch to get it to RTBC, even without mentioning the various follow-up tasks needed to get it really done. We want Drupal 8 feature complete by mid-February so we can shift gears to getting it out the door. This is *not* a long time at all when you consider the other stuff waiting in the wings SCOTCH-wise...
I think what would help significantly at this point is an outline of what, specifically, this patch is blocking in terms of other key features/capabilities so that we can determine what the impact on the overall Drupal 8 release will be if this patch continues to get delayed... as well as a "best guess" estimates of when those other things can be done. Does SCOTCH need another 6 weeks of work? Another 9 months of work? We need to get some grasp of magnitude here, so we can determine from there how to handle this particular patch: commit it basically immediately and let the chips fall where they may? Define an end point to get to and work towards that prior to commit? And do we need to de-scope some later elements of the initiative?
Because right now this patch seems to be at the center of everything in the SCOTCH world, and we need visibility. We all really want to see SCOTCH succeed, and this is the kind of patch which is hard to roll-back once it's in, and we need to ensure we can complete the requisite follow-up work without holding up the release of everyone else's hard work.
Thanks once again to the absolutely remarkable efforts of people like Tim, Camilla, Kris, Jess, and Jody, Sam, etc. for all the hard work on this. Let's figure out how to move forward from here.
Comment #307.0
xjmUpdated issue summary.
Comment #307.1
xjmUpdated issue summary.
Comment #307.2
xjmTweaking formatting and adding notes for expanding later.
Comment #307.3
xjmMisplaced list item.
Comment #307.4
xjmMore formatting tweaks
Comment #308
xjmI made a start at updating the remaining tasks in the summary, per @catch and @webchick's requests. I'll try to add more details about the proposed resolution, API changes, and the more "cleanup"-type remaining tasks later, but I already spent a couple hours on it today.
Comment #308.0
xjmUpdated issue summary.
Comment #308.1
xjmUpdated issue summary.
Comment #308.2
xjmUpdated issue summary.
Comment #308.3
xjmUpdated issue summary.
Comment #308.4
xjmUpdated issue summary.
Comment #308.5
xjmUpdated issue summary.
Comment #309
hass commentedBlock Library does not describe what the action is behind the link. We solved all this type of bugs in past when we changed Submit to Save/Delete/others. Rename this action link to Add block like in D7, please.
I need all the block hooks delete/update/insert for my linkchecker module. It's a no go to commit any code that does not allow to hook into.
Comment #310
hass commentedComment #311
xjm@hass, if you just need these hooks for custom, user-created blocks, then they will be added when custom blocks are converted to entities (which needs to be filed as a followup issue). If however it includes system blocks (menus, Views, etc.), then those hooks would either need to be added, or block instances turned into Configuration entities which also support full CRUD hooks, or you would need to react to the changes in a different way. @EclipseGc has also implied that there's an alternative for the removed hooks when I spoke to him about the API changes in this patch, so maybe he can clarify what that is. But I agree that right now there is a lot of regression from Drupal 7, so we need to clarify what the plan is.
Please leave this issue at Needs Review so that it can get the architectural review it needs; I'll add your point about the link text to the remaining tasks in the summary.
Comment #311.0
xjmUpdated issue summary.
Comment #311.1
xjmUpdated issue summary.
Comment #311.2
xjmUpdated issue summary.
Comment #311.3
xjmUpdated issue summary.
Comment #311.4
xjmUpdated issue summary.
Comment #311.5
xjmUpdated issue summary.
Comment #311.6
xjmUpdated issue summary.
Comment #312
xjmI just went back over all the blocks converted by this patch for #1823450: [Meta] Convert core listings to Views, and fully half of them should probably be Views eventually.
I also noticed that many of the block plugins violate our class naming standards, e.g.
CategoryBlockfor the Aggregator category block. In general, we are supposed to make sure the class names make sense out of context, even if this means duplicating some of the information in the namespace. Reference: http://drupal.org/node/608152Comment #312.0
xjmUpdated issue summary.
Comment #312.1
xjmUpdated issue summary.
Comment #313
xjmOh, one thing I forgot to mention in #312: For a lot of the view-ish blocks, the derivative discovery is currently filling the role that Views' argument handling generally does, and we'd eventually want to use the magic as-yet nonexistent context API somehow there. This is definitely worth opening a followup discussion for, because it's probably the single most important point of contact between VDC and SCOTCH.
Comment #314
hass commentedI need to look into all fields of every block from all block modules around and extract links inside. This is not limited to custom blocks. It should work like node_insert/update/delete() or however this is done in D8.
Comment #314.0
hass commentedUpdated issue summary.
Comment #314.1
xjmUpdated issue summary.
Comment #316
xjmAttached:
@todofor an inline comment.BlockPluginUIderivative class, which was utterly misleading because it claimed it was providing block plugin definitions rather than plugin UI plugin definitions.I was also going to change the "Block library" link text per @hass' feedback, but it's a little more complicated because that's the label of the plugin UI plugin. I wasn't sure if or how I should change it.
Comment #317
eclipsegc commentedxjm has posted a LOT of stuff here in her review and +10000000000 to that. There are a lot of things that are hard to address, and some which are easy to address. I noticed there was a lot of (valid) criticism of the existing interface, so I tried to clean that up a bit, and all the corresponding blocks. tim will be posting the full patch shortly, this is the interdiff for reference.
Eclipse
Comment #318
tim.plunkettOkay, I had to push up #316 because it never made it into the branch (somehow). Rebased #317 onto that.
However, it seems that the interdiff from #294 is missing from the branch? Not sure what's going on there.
Here is the current branch.
Comment #320
tim.plunkettAh, trailing comma added by @EclipseGc :)
Comment #322
gábor hojtsyNot strictly related, however these three issues deal with converting page elements to blocks (ie. actually applying this API to things that are not yet blocks but should be):
- #1053648: Convert site elements (site name, slogan, site logo) into blocks
- #507488: Convert page elements (local tasks, actions) into blocks
- #1869476: Convert global menus (primary links, secondary links) into blocks
First two pointed out by @EclipseGC, third just opened, all contain patches from @EclipseGC from earlier. Feedback is welcome! :)
Comment #323
tim.plunkettHere's the newest patch, with @EclipseGc's interdiff.
Comment #324
xjm#318 through #323 and the current
1535868-blocksbranch in the sandbox do NOT include about a dozen hours of my work, so please don't roll anything further against them. I'll try to resolve this when I get home from work; I still have the old branch with my changes locally.Comment #325
xjmSo, after talking to @EclipseGc, the main point of #317 is to remove the wrapper/specific distinction from the interface, because the interface shouldn't care if a specific implementation chooses to provide some defaults. My only concern is that the method names
blockAccess(),blockSettings(), and so on are a bit confusing; they're not as effective at telling me what they do (edit: or more specifically, how they differ fromaccess()andsettings()) as the previous names. This patch also loses a lot of the documentation I added clarifying the situation (as per #324) but @tim.plunkett and @EclipseGc and I figured out that was just an accident.So, for these (and similar), it is still overriding a method on the base class (
BlockBase::blockAccess()), so the summary template should still be "Overrides blah."You can either include both the removed lines and the added ones, with a blank line between them, or put an inline comment inside the method. Also, the verbs in docblocks should be the third person indicative ("Provides", "Checks", etc.). This is different from inline comments, where it's normal to use an imperative (e.g. "Provide").
So, something like:
(Note also that instead of repeating the code in word form, I explained what it meant.)
Is moving this out of the annotation intentional? Because I swear @tim.plunkett's later patch moves it back.
Please see the examples in 1354 on how to write a function or method docblock, since I already corrected dozens of them above:
http://drupal.org/node/1354#functions
This should start with a one-line summary that begins with a third-person verb, 80 characters or fewer. The correct format for the return value would be something like:
Or something.
However, trying to write a description for the return value here--and how awkward it is--makes me wonder if it mightn't be better to instead make
$settingsa member variable on the class, with getters and setters perhaps.Comment #326
eclipsegc commentedInteresting notion actually. That might work nicely. It sounds like it belongs in #1764380: Merge PluginSettingsInterface into ConfigurableInterface though.
Comment #327
xjmIt would be better to describe here what the "protected $configuration variable" is or does, and for the variable to be declared on the class so that its exact usage and purpose can be documented. I'll try to clarify it when I reroll #317 against the actual branch.
Comment #328
sdboyer commentedre: #294, and what's currently reflected in the issue summary.
first, lemme refer back to the latter section in #108. there was not then, and there is not now, a way forward with this patch if we cannot accept that it leaves many questions unanswered. anything having to do with the block library, for example - that entire paradigm needs to change.
@xjm, you've done amazing work with this here, and i really want to be respectful of that. but it seems to me that you're applying a level of rigor to this patch that we knew in the first place it could never stand up to. to that end, i won't modify the issue summary - just highlight the things in the list of remaining tasks that are either definitely follow-ups (not for discussion here), or simply aren't applicable in the context of the eventual goal.
while this patch does introduce it, this is really something we should apply "good enough" to and tackle in follow-up. we can't hold up the base API on its interface.
follow-up only, for the same reason as above.
the UIs for how this works in the theme-attached world are different from the final target. we'd be planning architecture for something we intend to more or less throw out.
please, no followup, and no discussion. it gets addressed naturally as we go.
let's please not, for the reasons given above.
as you said in the place the original quote is from - definitely out of scope for this issue. i suppose explicit follow-ups would be fine now, but let's mark them postponed right away. establishing the best practices is something that'll be easier to do once we see blocks working in the context of a) display rendering and addressable rendering, b) working with assets (once that's sorted), and c) how data source injection works. not saying those have to be done, just that they should be *properly* underway.
"implicit testing" is enough for this issue. let's not discuss, follow-up only.
no sense in discussing this, as it would be tied to the UI introduced in this patch, and (as above) the assumptions and context of that UI are all subject to change. fortunately, while that discussion is just *weird* in the context of the current UI, it gets much more sane in the context of displays.
follow-up. i can't speak for the Views
OverrideDisplaysTest, but i wrote theFilterHooksTestchange - the dependency on custom block was annoying and pointless, and we still cover the same stuff.something seems to be fucked up with
BlockTemplateSuggestionsUnitTest. i wrote that change, but it had to change a fair bit because the whole way we compose template suggestions changed. it's obviously passing now, but i vaguely remember the logic looking pretty different in there, and it does seem like it covers less than what i originally wrote.we can't even begin to have this discussion, as we don't know what the final upgrade target looks (exactly) like yet. we could post a follow-up, but this is more properly the domain of a wider page rendering upgrade path discussion.
we could (and sure, should) microbench certain subcomponents of this code for comparison to what we have now, but full-scale benchmarking here is fairly meaningless as the whole rendering stack will be changing overtop of them.
the issues you list, [#1853190} and #1722882: Plugin CacheDecorator caches globally, ignores request context, and does not specify tags for cache items are good, relevant followups. corollaries to #1187726: Add caching for configuration / rework config object loading (Was: Memory usage and i/o from config objects) will also be quite important. frankly though, i just don't know how useful the information we get from benchmarking this patch would be.
again, we're chucking significant pieces of the UI; beyond that, you've listed the followups.
Comment #329
xjmRe: #328, generally, I think you've misunderstood that the point is to file followup issues for most of these points so that we can focus on the things that are critical before commit. If you feel something can happen as a followup, please do file the followup and edit the summary to link the followup instead.
I don't buy that anything will "happen naturally," though. There's too much risk involved. But I'd love to see followup issues for most everything I pointed out.
And I'm always rigorous. I'm not going to pretend I don't see something--some 20 things--just because it's after feature freeze and the patch is 400K. That would be dishonest. :P
Comment #330
sdboyer commented#329 - as we discussed in IRC, i was reading these notes with the eye of, "reasons why i don't think this should be committed," as opposed to, "making a list of possible issues that SOMEBODY may think are reasons it shouldn't be committed." sorry. i think we've adequately sorted this out in our verbal discussions this morning.
Comment #331
effulgentsia commentedJust a reroll to apply to HEAD. No actual changes.
Comment #331.0
effulgentsia commentedUpdated issue summary.
Comment #334
xjmI've updated the summary based on @sdboyer's feedback in #328. New patch shortly.
This morning we (@webchick, @EclipseGc, @sdboyer, @tim.plunkett, @effulgentsia, @Gábor Hojtsy, @Crell, @heyrocker, and I) discussed this patch in detail. We concluded:
Therefore, the way forward is to commit the patch once a few remaining commit blockers are fixed, and file as many followup issues as needed. Some of these followup issues may be closed as duplicates when other work lands, and it was suggested to tag those issues with "If SCOTCH fails" and address them after Feb. 18 if they are not resolved by then. (Cheery...)
We identified the following commit blockers:
We identified the following critical followups:
page.tpl.phpto blocks (see #322).Other issues, including writing more extensive documentation, converting custom blocks to content entities, improving the logic in
build()implementations, and so on will also be addressed in other followup issues. We will file all these issues before commit and link them in the issue summary.Comment #334.0
xjmUpdated issue summary.
Comment #334.1
xjmUpdated issue summary.
Comment #334.2
xjmUpdated issue summary.
Comment #334.3
xjmUpdated issue summary.
Comment #334.4
xjmUpdated issue summary.
Comment #334.5
xjmUpdated issue summary.
Comment #334.6
xjmUpdated issue summary.
Comment #335
xjmThe attached patch cleans up the interface and base class. @EclipseGc and I worked on it together. Changes:
The concept of "wrapper" methods is removed from the interface, which should only define the required methods for all blocks.
The former "wrapper" methods have all been renamed:
The block type-specific helpers have been moved onto the base class, and all have names prefixed with
block. (We might want to rethink this naming pattern in a followup, but at least it's consistent.)The interdiff provided is against #316 since the subsequent patches were missing a bunch of earlier changes.
Comment #335.0
xjmUpdated issue summary.
Comment #335.1
xjmUpdated issue summary.
Comment #335.2
(not verified) commentedAdded layout UX issues.
Comment #335.3
xjmUpdated issue summary.
Comment #337
effulgentsia commentedAn initial review. So far, I just started looking at changes to tests of modules other than Block to see what we're regressing. I haven't read all the comments here, so apologies if some of these have already been answered.
This looks unnecessary. I tried removing it locally and tests still passed for me.
The variable should be 'theme_default', not 'default_theme', but within a test, we shouldn't need the variable_get() at all: we know we're using the testing profile, and therefore, the 'stark' theme.
If we're giving the user 'administer blocks' permission, we should call that $admin_user, not $web_user. However, maybe this can be made entirely unnecessary? See my next comment.
This is an aggregator module test, so it doesn't need to test the UI of adding system.module's help block. Do we have an API function for enabling a block that we can use instead? That will also let us avoid logging in as someone with administer blocks permission (see previous comment).
Why are we removing this test? Do we have a follow up issue to restore it?
Why is this being made protected? Doing so doesn't stop it from being run, but it looks weird for this one test to be made special like that.
It's nice this got condensed from two POSTs to one, but could we name the one variable $block instead of $edit, for consistency with the other tests in this patch?
Also, comment.module defining a block plugin id of 'recent_comments' risks collision with say a recent.module. Shouldn't the plugin id start with 'comment_'?
We shouldn't need this.
Are we sure we want to remove these assertions? Why did we change this test to make the block always visible?
-18 days to next Drupal core point release.
Comment #338
effulgentsia commentedSome preliminary benchmarking results:
First of all, we need to add CacheDecorator to BlockManager. Without it, displaying the home page after a new Standard profile install is 15x slower (1000ms) with this patch than with HEAD (70ms).
With
$this->discovery = new CacheDecorator($this->discovery, 'block', 'block');added to BlockManager, the patch is still slower, but not as dramatically:HEAD: 70ms
Patch: 75ms
The above is with basically 3 blocks visible to the anonymous user (User login, Powered by Drupal, and Footer menu). I then added 4 more (Recent comments, Recent content, Who's online, and Who's new) to the second sidebar for a total of 7. That resulted in:
HEAD: 78ms
Patch: 88ms
We generally do not commit ~10% regressions casually. We'll need some XHProf sleuthing to find out what's causing it. Some of it is likely extra class loading with a still slow autoloader, which we know we need to fix and is not this patch's problem to deal with. Some of it is likely known CMI performance problems, which we also know we need to fix and is not this patch's problem. But we should find out if there's also a significant portion from the Block code itself.
Comment #340
xjmAh, sorry for the confusion: The entire feature is being removed here, not just the test. I'm going to file a followup issue to possibly add back the feature (edit: #1871854: Decide whether to restore per-user block visibility or provide it in contrib) (along with the other points).
I bumped #1853190: Cache block plugin definitions to critical, though with numbers like that (a second? lmao) that might be more of a commit blocker... @tim.plunkett suggested we could just add that one line here it but I'm not sure what the ramifications would be for the scenarios described in that issue.
The attached is mostly @EclipseGc's latest commit, with a few more docs clarifications from me:
block_build()procedural wrapper.build()method on the base class (per the @todo).BlockBase::blockBuild()method consistent with the other block type-specific methods so that individual plugins can implement this method and still have their output altered by alter hooks afterward.Comment #340.0
xjmUpdated issue summary.
Comment #340.1
xjmUpdated issue summary.
Comment #340.2
xjmUpdated issue summary.
Comment #340.3
xjmUpdated issue summary.
Comment #341
xjmI had an actual nightmare last night that we committed this patch and it was totally broken and throwing exceptions all over the place, so I manually tested it. TLDR: Most of the stuff that we are missing test coverage for does at least work, there are UX issues we already knew about that are out of the scope we've set in #334, and there are a couple non-UX bugs we should fix before commit:
custom_block.moduleneeds to be added to the Standard profile.My unfiltered observations are below: Most of the following should be addressed in followups, and mostly If SCOTCH fails followups since we hope to replace a lot of the UI and the workflow with the layout builder UI.
There are a few CSS bugs in the UI:

The button label "Configure block" is a little confusing. What I want to do is add a block, not configure an existing one, but clicking this button apparently adds and configures.

Added several copies of the "Powered by Drupal" block all over Bartik in various regions with various titles, weights, visibility settings, etc. They all work! Hallelujah!
I did notice that the default core blocks are missing their titles:

Enabled Stark and set it as default. It got all the block configurations Bartik had.
Moved some blocks around in stark and changed some configurations. Switched back and forth between Bartik and Stark and confirmed that each theme retains its own settings.
Tried to add a custom block. Couldn't figure out how until I realized the module was off. The Custom Block module needs to be added to Standard.
Do we really want the custom block's title to default to "Custom Block"?...
Missed setting the region settings. It says "Stark (default theme) field is required." What the what? This apparently means the region setting. That's not a very good form element label. Maybe this happens in HEAD too.
Created a custom block and placed it twice in the same region. This works fine. Reordering them works fine too.
Switched back to Bartik and added the same custom block there as well. Missed the region select box again; that's really annoying. Filling out the machine name over and over is also annoying; can we generate defaults for that?
Added yet another copy of my custom block. I really want to click on the regions in the admin listing to add a block to that region, but I guess that's what the layout builder UI is for. ;) Also do we even ever use the "Disabled" blocks region anymore? I can't figure out how to disable a block. Is that operation not exposed in the UI?
Played with menus a bit. Prefixing the menu block titles with "Menu" and "System Menu" is also weird. I also want to be able to place menus right after I create them.
Also, I disagreed with Kevin at BADCamp, but now I actually think I agree... placing blocks in a layout feels like more of an appearance task. Stuff like menus, taxonomy, etc. is the underlying structure, not what I see right away on the page.
Again, most of this should be filed as followups.
Comment #343
xjm@EclipseGc is looking into the caching issues.
Attached:
{block},{block_language}, and{block_role}tables from the schema. (I also added the tables to #1860986: Drop left-over tables from 8.x.)I also noticed that we're removing two configured block instances that Minimal previously had, the Tools and Administration menus in the first sidebar. Is this intentional or do we want to re-add them?
Comment #344
eclipsegc commentedI'm going to go with "No". Do we want to fix that now?
The region settings in head are per theme, I probably missed updating the error message when I decoupled that.
I'm not opposed to this, but no one has really come up with what I'd consider a valid suggestion here. We can't use block title, many block instances won't have one. We can't generate them by some numerical scheme since we'd like them to have some likelihood of being unique from one site to the next. We can't use UUID's since we generate CSS ids and such from them. I'd love to autogenerate something sane here, but I have yet to come up with a good way of doing that. In short, I'm open to suggestions :-)
The disabled region is how you disable a block. Obviously I'd love to remove the region and expose disabling of blocks in an action drop down next to the block instance in the regions, but that would have required generating a UI queue that it was disabled, and further UI alteration for a UI we hope to completely remove. As such I elected to simply leave that tasks as close to what it is in HEAD as possible.
This is pretty trivial to fix if you'd rather just have the menu's name there or something.
Eclipse
PS: I want click "add a block" in the regions too ;-)
Comment #349
David_Rothstein commentedFrom the issue summary:
It's implied that this is a critical followup, but isn't it actually a new feature? There is already no way for contrib modules to react to most of those things, because hook_block_configure(), hook_block_save(), and hook_block_view() aren't actual hooks; they're "plugin wannabees" that only get invoked in the original implementing module. So if this patch simply converts them to actual plugins, there's no regression.
hook_block_list_alter() is a real hook, but from what I can tell the patch basically renames it to hook_block_access() and makes it run on each block individually rather than all at once, so it's essentially still there? Hopefully, the new one still has the same performance goodness that the old one did, though... I don't know if it does, but whoever wrote the Overlay part of this patch evidently thought so since they left the comment about that alone :) See:
Comment #350
David_Rothstein commentedIt doesn't because the region setting isn't required in HEAD. The patch makes it so:
This is very buggy because it means that you can't create a new block in the disabled state, and (worse) if you go back and edit an existing block that was previously disabled it forces you to put it in a region before you can save it again.
Is there a reason that #required line can't just be removed? (I'm actually pretty amazed that this patch doesn't fail hundreds of tests with that in there...)
Comment #351
David_Rothstein commentedAnother thing I noticed (which I don't think is mentioned above, though I don't claim to have read all 350 comments in detail) is that if you create a custom block and go back to edit it, the block body field is disabled. So, once you type something in there you can never edit it again. That's kind of a problem :)
Once again, it's not too hard to find the direct cause in the code:
Why does that line exist?
Comment #352
eclipsegc commentedThis is true, but only for core, not for contrib. hook_block_save() for instance, has a switch statement on the delta in core typically, but in contrib you could react to all blocks by just disregarding the delta, which is exactly what a handful of modules do and why it's being considered a regression. I was in exactly the same frame of mind as you when I wrote these portions of the patch, I've since been convinced that I was wrong.
hook_block_list_alter()
Chances are the performance advantages of this hook have been discarded (I'm guessing). It was a REALLY weird hook in the first place and I tried to standardize it a bit and remove some of the wtf. This gets called at the same level as the $block->access() method does (which actually wraps a call to this hook) and only runs if all the other access/visibility has come back true. Just thought I'd clarify this a bit more. If there's some greater concern around this architecture, let me know.
xjm touched on this a bit above, and I tried to address those concerns to some degree, however the intent was that placing blocks in the disabled region in the UI didn't actually affect their region, but only their status. HOWEVER, you are correct in your assessment of the situation, because it is indeed updating the region on the actual configuration. I had hoped to push off status specific changes from the UI this go round. I think we need to consider what sort of implication this has. Perhaps unrequiring it is the easiest course. We should test that a bit.
Agreed, the intent was that you'd have a separate UI for updating the custom block's actual values, however I also intended on custom_block just not even being in this patch and having a critical follow up for it, so there are probably a couple rough edges there. I'd be ok with removing the requirements here as well, but it gets odd when re-using a custom block cause changing one instances changes all, also we need to double check the crud on that and make sure it works appropriately. I'd really like to see custom blocks replaced by content entities in the near term (after this patch lands).
Eclipse
Comment #354
xjmI'd guess for #351 it has to do with placing multiple instances of the same custom block, or something? But that's definitely a bug; I checked and I can't find any way in the module to update the block body of a custom block.
Ah, regarding custom blocks, I'm guessing our custom-blocks-as-entities patch should then include a form controller implementation as well as the entity conversion itself? I could see bumping that followup to a critical bug as well and fixing it there, though it's definitely a much bigger regression than something just a few contrib modules relied on.
(Edited to merge consecutive comments; I am determined to keep this under two pages.) ;)
Edit 2: Also, David's comments really underscore for me how important it is to add more complete test coverage. Right now I'm thinking the next steps after committing this patch are:
Comment #355
David_Rothstein commentedI don't understand that actually, but will comment in #1871696: Convert block instances to configuration entities to resolve architectural issues instead to keep the discussion here from ballooning :)
Let's see, I think the main performance concern would be if the block is ever built/viewed before its access is checked. Based on this in the patch:
I think that means it's OK. But I haven't really traced out the full behavior.
I find it a little unusual that the hook is only invoked after the default access/visibility checks have come back true (vs. having the default checks take place in a hook implementation of their own, like they do now: http://api.drupal.org/api/drupal/modules!block!block.module/function/block_block_list_alter/7). Having it the latter way, like it is currently, would make it easier for other modules to swap out the default checks entirely (for all blocks) if they want to, that kind of thing. But it's not an earth-shattering regression or anything, and probably easy to fix.
Comment #355.0
David_Rothstein commentedUpdated issue summary.
Comment #355.1
xjmUpdated issue summary.
Comment #355.2
xjmUpdated issue summary.
Comment #356
xjmAttached:
Before
After
Comment #356.0
xjmUpdated issue summary.
Comment #356.1
xjmUpdated issue summary.
Comment #356.2
xjmUpdated issue summary.
Comment #356.3
xjmUpdated issue summary.
Comment #356.4
xjmUpdated issue summary.
Comment #356.5
xjmUpdated issue summary.
Comment #356.6
xjmUpdated issue summary.
Comment #356.7
xjmUpdated issue summary.
Comment #356.8
xjmUpdated issue summary.
Comment #356.9
tim.plunkettUpdated issue summary.
Comment #356.10
xjmUpdated issue summary.
Comment #356.11
xjmUpdated issue summary.
Comment #356.12
xjmUpdated issue summary.
Comment #356.13
xjmUpdated issue summary.
Comment #356.14
xjmUpdated issue summary.
Comment #356.15
xjmUpdated issue summary.
Comment #356.16
xjmUpdated issue summary.
Comment #356.17
xjmUpdated issue summary.
Comment #356.18
xjmUpdated issue summary.
Comment #358
xjmAttached:
We should also add a followup to remove the<none>placeholder since it's now redundant.<none>doesn't work anymore either.)Before
After
Edit: The fact that it shows a different theme name in the second screenshot and that the number of comments is cropped out PEBCAK, not a bug. ;)
Edit 2: @tim.plunkett noticed that the
admin_themevariable there has not yet been updated for #1798872: Convert admin_theme to CMI; I'll fix it once I'm sure the patch is green.Comment #358.0
xjmUpdated issue summary.
Comment #358.1
tim.plunkettadded disasm (helped at blocks sprint)
Comment #359
xjmI'm still working through the followup issues and the recent comments, but here is the current status of this issue based on a discussion with Dries last week:
I'm adding this information to the summary.
Comment #359.0
xjmadded a UI followup
Comment #359.1
xjmUpdated issue summary.
Comment #359.2
xjmUpdated issue summary.
Comment #359.3
xjmUpdated issue summary.
Comment #359.4
xjmUpdated issue summary.
Comment #359.5
xjmUpdated issue summary.
Comment #359.6
xjmUpdated issue summary.
Comment #359.7
xjmUpdated issue summary.
Comment #359.8
sdboyer commentedAdds blood oath to issue summary.
Comment #359.9
xjmUpdated issue summary.
Comment #359.10
xjmUpdated issue summary.
Comment #359.11
eclipsegc commentedAdd my name to the blood oath
Comment #359.12
xjmUpdated issue summary.
Comment #359.13
xjmUpdated issue summary.
Comment #359.14
xjmUpdated issue summary.
Comment #359.15
xjmUpdated issue summary.
Comment #359.16
xjmUpdated issue summary.
Comment #359.17
xjmUpdated issue summary.
Comment #359.18
xjmUpdated issue summary.
Comment #361
xjmAttached fixes a couple minor bugs introduced in the last two patches, plus addresses @effulgentsia's feedback in #337:
All fixed.
Edit: missed one:
I fixed the variable name, but I actually disagree with not checking the variable. We don't want to hardcode the theme in case we change the profile used in this test--or the theme used by that profile--in the future. Stuff like that bit us hard when we were converting tests for the node frontpage listing.
This has a followup: #1872540: Provide a test helper method for creating block instances
The feature was removed entirely; the followup is: #1871854: Decide whether to restore per-user block visibility or provide it in contrib
This has a followup: #1875344: Add back removed test coverage in Views' OverrideDisplaysTest
I actually almost recommended the opposite in my reviews... a month ago now, ugh... that all these should use
$editinstead of$blockbecause that's more the pattern elsewhere. I've left it alone here since #1872540: Provide a test helper method for creating block instances should tear all of it out anyway.I'm not sure whether this is an issue or not... @EclipseGc? It seems to me like we shouldn't need to duplicate the namespace for the plugin inside its name, but I'm not actually sure.
We also still need a followup issue to discuss the implications of disabled block instances. Other than that, I think all of the feedback from @effulgentsia and @David_Rothstein has been addressed, and we're now just waiting on #1722882: Plugin CacheDecorator caches globally, ignores request context, and does not specify tags for cache items. I also have a list of 15-20 more minor followups to file in addition to the nearly 30 that are already linked in the summary... when do I get my statue again? :)
Comment #361.0
xjmUpdated issue summary.
Comment #361.1
xjmUpdated issue summary.
Comment #361.2
xjmUpdated issue summary.
Comment #362
larowlanfwiw the comment.module recent_comments block should go the way of views in #1823450: [Meta] Convert core listings to Views
Comment #363
xjmYeah, in light of that I guess it doesn't matter either way. Still, it would probably be good to state one way or the other whether plugin ID collisions are a concern or not.
Comment #364
eclipsegc commentedA views related plugin_id should end up looking like views:recent_comments or something similar no? I know I did the conversion, so it should be something along those lines. Once there's a valid replacement for it, we just delete the old plugin. Plugin id conflicts should have SOME ramifications (to answer the actual question) but since it's not supported behavior, I don't actually know what would occur. Chances are we'd either get some sort of exception or a silent failure in which one plugin just simply doesn't show up. Not sure which. If we really care I'll happily dig in and see which behavior should be expected, but it sounds like a follow up issue at the most, and a non-issue at the least.
Eclipse
Comment #365
xjmA few recent cleanups, including some minor @todos from the issue summary, plus:
custom = TRUEflag on the custom block plugin definition was redundant and unused anywhere except in a method in the plugin UI that didn't work anyway (excludeDefinitions()). I've removed it here as well as the method. We can add it back in a followup if it turns out there's a usecase...There's also currently a minor JS bug following a recent core commit; see #1875632-12: JS settings merging behavior: preserve integer keys (allow for array literals in drupalSettings).
Comment #367
xjmFail in #365 was just a goofy typo.
Comment #367.0
xjmUpdated issue summary.
Comment #367.1
xjmUpdated issue summary.
Comment #367.2
xjmUpdated issue summary.
Comment #367.3
xjmUpdated issue summary.
Comment #367.4
xjmUpdated issue summary.
Comment #367.5
xjmUpdated issue summary.
Comment #370
xjmGreat success! #1722882: Plugin CacheDecorator caches globally, ignores request context, and does not specify tags for cache items is in now, and @EclipseGc added the cache decorator to the block manager to cache the block plugin definitions. We also sorted out where we needed to do cache invalidation. I've manually tested the updated patch (mostly @EclipseGc's work with some polish and input from me) and confirmed that the block plugin definitions are cached, and that when I (e.g.) update a menu, the definitions cache is invalidated so that the updated menu block definitions are available in the block library.
I think we are almost done here. The one remaining task is to do a round of thorough benchmarking (see #338). I'll update the summary.
Comment #370.0
xjmUpdated issue summary.
Comment #370.1
xjmUpdated issue summary.
Comment #370.2
(not verified) commentedUpdated issue summary.
Comment #372
Anonymous (not verified) commentedi was just going to benchmark this, but the fails stopped me, so i tried to fix them.
seems there was some cache clears missing for block plugin definitions. i added them to the tests, but i suspect we should be putting that in some CRUD method or other.
and there were some changes to menu links in RouterTest::testMenuHidden() that broke stuff, like this, which i reverted and things seem green again.
wonder what the bot thinks.
Comment #372.0
Anonymous (not verified) commentedUpdated issue summary.
Comment #372.1
xjmUpdated issue summary.
Comment #373
xjmAttached adds a couple cache clears where needed (the module enable form clears caches, but not
module_enable()or the simpletest module installation).I don't know what the deal is with the
RouterTestor why adding a menu block that had nothing to do with the test magically made it work previously, but the previous change was no longer necessary and it now works without the block. I suspect some difference between the sandbox and 8.x HEAD awhile back that's since been fixed.Edit: The interdiff is against #370; I crossposted with @beejeebus.
Comment #374
xjmOops, guess I should have posted #373 earlier.
The cache clears happen in the procedural code, form submit handlers and whatnot. Assuming my patch in #373 passes, nothing more is needed -- it only adds cache clears at the beginnings of test methods.
Comment #374.0
xjmUpdated issue summary.
Comment #374.1
xjmUpdated issue summary.
Comment #375
msonnabaum commentedEclipseGc asked me to profile this, so I ran the front page 80 times with and without the patch. Here's the aggregated diff totals:
I also used the apc loader to reduce the noise a bit, so the regression is a bit worse without it.
Both aggregated runs are attached. 1 is without patch and 2 is with. Hopefully someone who knows the patch better can dig through these a bit more.
Comment #376
xjmmsonnabaum++
Some updated screenshots for the summary.
Comment #376.0
xjmUpdated issue summary.
Comment #376.1
xjmUpdated screenshots.
Comment #377
effulgentsia commented15% is worse than what I saw in #338, but I don't think it should block commit. We can dig into identifying and reclaiming it in a follow up. It would help morale and productivity to get this in and work on manageable follow ups rather than constantly rerolling this beast. Therefore, RTBC.
Comment #377.0
effulgentsia commentedUpdated issue summary.
Comment #378
dries commentedI've decided to commit this patch as it is blocking a lot of other important work, including bug fixes. Yay! Amazing work on this patch. It's a big, fundamental milestone for Drupal 8 that should enable quite a bit of innovation.
Committing this patch will push us over the thresholds though. We should make an exception and commit some features that are RTBC at the time of this commit, as people have been waiting for their patches to be committed too. We could commit the other patches first, but it would require yet another re-roll of this patch which is non-trivial and causes a lot of conflicts (hence the 'Avoid commit conflicts' tag). I've asked to Angie provide a list of the patches that can be committed based on this exception.
I'm planning to spend some time on #1810428: [Policy, no patch] Adjust major and critical task thresholds during code thaw to address the thresholds problem for other initiatives.
Comment #379
webchickHere's the list of RTBC features at the time of commit:
#1819760: Add a REST export display plugin and serializer integration.
#1401778: Add the ability to clone a display while changing the display plugin
#1869124: Customizable "true"/"false" Views output for booleans
#1849356: Add a HTTP response code area handler
#1446600: EntityFieldQuery (pseudo-)join support
#1308054: Add an abstract DrupalReadOnlyStreamWrapper that other stream wrappers can extend
I'll work on them this weekend! :)
Comment #380
webchickOops, also change notice!
Comment #381
plachAnd this :)
Comment #383
eaton commentedCelebrate!
Comment #384
eclipsegc commentedWriting the change notice.
Comment #385
effulgentsia commentedYay!
I'm looking into the benchmarks a bit more, but in checking to make sure we're comparing apples to apples, I discovered #1880504: Regression: incorrect default blocks and weights in Standard profile following plugin conversion.
Comment #387
effulgentsia commentedAnd another regression: #1880588: Regression: invalid HTML in menu blocks due to _block_get_renderable_block() clobbering #theme_wrappers of block contents
Comment #390
xjmThe main change notice is here:
http://drupal.org/node/1880620
We should probably add two additional change notices, one for the addition of the custom block module, and one for the change in block template names.
Comment #391
effulgentsia commentedHopefully, my last critical regression I'll be filing today: #1880646: [meta] Update block HTML IDs now that they're plugins.
Comment #392
Anonymous (not verified) commentedlet's see if we can back some of the 15% slowdown in #1880766: Preload configuration objects
Comment #393
jibranI think we can add all the keys (cache, properties, weight, status, region, visibility and pages) to
blockSettingswhich were defined inhook_block_info. I think little keys explanation will be good.Additional keys(cache, properties, weight, status, region, visibility, pages and etc.) for a specific block type are added with the
blockSettings()method.Comment #394
xjmThat's not true, though. A lot of those keys are normally added in the annotation. However, I'll see if I can clarify the text. Edit: Note that I was deliberately a little vague because there is a followup issue to improve the architecture around plugin settings: #1764380: Merge PluginSettingsInterface into ConfigurableInterface
Comment #395
mradcliffeUh-oh, #1881096: Regression: Site broken when disabling module without removing block instances.. :(
I filed that as a separate bug, but if it needs to be addressed in this issue please close the other one.
Comment #396
sunAnother one: #1881176: Revert bogus User module update number changes of Blocks to Plugins conversion
Comment #397
gábor hojtsyAnother one with a patch I provided: #1882252: Regression: Block visibility summaries are broken
Comment #397.0
gábor hojtsyAdded #1880274 to followup list
Comment #397.1
xjmUpdated issue summary.
Comment #397.2
heather commentedUpdated issue summary.
Comment #397.3
xjmUpdated issue summary.
Comment #400
xjmPlease tag further followups for this issue with "Block plugins"; we're about to run out of comments that fit on one page, and this node takes too long to load when referencing the followup list in the issue summary. :)
Comment #401
pcambraFollowup: #1892472: Document hook_block_access
Comment #402
webchickThis has been waiting for a change notice for over 6 weeks now. Let's please get this knocked out.
Comment #403
gábor hojtsy@xjm said in #390 that there should also be a change notice for custom blocks module. I've added one at http://drupal.org/node/1933768 (also tied in to the custom block entity type change). Also updating the original change notice at http://drupal.org/node/1880620 for the change in #1591806: Change block "subject" so that it's called a (admin_)label like everything else on the theme layer.
@xjm: tried to look into doing a change notice for "change in block template names" but the only new/changed tpl.php I found in the patch was "system-plugin-ui-form.tpl.php" which is a new admin template, not really relevant for blocks themselves. I don't think that is worth a change notice. What did I miss?
Comment #405
nicxvan commentedReviewed change notice: Blocks are now plugins
Looks clear to me, however there does not seem to be an example of hook_block_alter() demonstrated.
Also reviewed change notice: Custom blocks are now content entities, in separate module
This is simple to understand and clear.
Comment #406
xjmWhat I was alluding to is not changes in the names of templates themselves but in 1. render array keys and 2. variable name changes in theme preprocesses. In my reviews above, I commented on this for three places:
So, what I think is still needed is a change notice with an example of altering or theming a block to be rendered in D7, and how it changes in D8.
Comment #407
theduke commentedSeems like an API change for BlockInterface is needed: #1951386: Extend BlockPluginInterface::access to allow passing in an account.
Comment #408
yesct commentedI'm a bit confused about what has been documented in change records and what still needs a change record.
Maybe someone familiar with the issue can summarize/update the remaining tasks for that, and I'll try and find someone to do it.
Comment #409
effulgentsia commentedThe "D8 upgrade path" tag was added to this issue in #172. However, since then, #1871700: Provide an upgrade path to the new Block architecture from Drupal 7 was opened, is critical, and has that tag. So, removing it from this one.
Comment #410
xjm@YesCT, this is documented in #406, two comments above yours.
Edit: I updated the remaining tasks in the summary to make this information easier to find.
Comment #410.0
xjmUpdated issue summary.
Comment #410.1
xjmUpdated issue summary.
Comment #411
tim.plunkettComment #412
catch#2083415: [META] Write up all outstanding change notices before release.
Comment #412.0
catchUpdated issue summary.
Comment #413
xjmUnfortunately, the original change information is now out of date, so the render and theme changes from this patch are no longer relevant. Also unfortunately, d.o won't let me close this issue. ;)
Comment #414
jessebeach commentedChange record has been updated. Let's finally put this issue gently to bed.
Comment #415
xjm