Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Block example module should be updated for D8.
Comment | File | Size | Author |
---|---|---|---|
#16 | 1630760-16.patch | 11.87 KB | marvil07 |
#16 | interdiff.txt | 5.31 KB | marvil07 |
#15 | 1630760-15.patch | 12.04 KB | marvil07 |
#15 | interdiff.txt | 16.12 KB | marvil07 |
#12 | 1630760-4-block-example-module.patch | 16.64 KB | ybabel |
Comments
Comment #1
alberto56 CreditAttribution: alberto56 commentedHere is a patch
Comment #2
pcambraBlocks are plugins now and the code above will need to be adapted.
Change notice: http://drupal.org/node/1880620
Comment #3
pcambraJust an update of progress, mostly some thoughts on this
I guess we need an example of Derivatives too: http://drupal.org/node/1653226
Also the usage shown in the example module for hook_block_list_alter is quite weird, that hook has been removed in the plugin conversion by a hook_block_access so I guess we need to alter the example.
Additionally, hook_block_view_alter() has been refurbished a little in favor of hook_block_view_ID_alter() and hook_block_view_NAME_alter() but it remains around so we'd need the three of them included.
Related: #1874576: Improve the documentation and naming of hook_block_view_alter() hooks
Comment #4
pcambraAnother blocker in the way #1899772: Fix name retrieving for block plugins to fix hook_block_view_NAME_alter()
Comment #5
ybabel CreditAttribution: ybabel commentedFor the Drupal Global Sprint I worked on porting block example module to Drupal 8.
The 3 blocks works (empty / configurable_text / uppercase).
I did not found how to translate all the plugin anotations. Theses ones are not yet recognized :
I did not found how to implement block_example_block_view_alter correctly.
I tried something like that :
Tests not ported yet.
Comment #6
alberto56 CreditAttribution: alberto56 commented@ybabel
thanks. However you might have provided the wrong file: the patch provided is identical to the one in comment #1.
Comment #7
ybabel CreditAttribution: ybabel commentedright ! my mistake.
here is the good patch
Comment #9
ybabel CreditAttribution: ybabel commentedmy patch didn't work because DBTNG and page_example are outdated ... I didn't work on them though.
But it work.
Comment #10
ybabel CreditAttribution: ybabel commentedtests added, and patch updated
Comment #12
ybabel CreditAttribution: ybabel commentedComment #13
rfay#12: 1630760-4-block-example-module.patch queued for re-testing.
Comment #15
marvil07 CreditAttribution: marvil07 commentedSeveral changes to pass tests again.
hook_block_view_alter()
to reflect the new type of the second parameter. Also re-insert the behaviour from D7 version.Drupal\block_example\Plugin\Block
namespace instead ofDrupal\block_example\Plugin\block\block
.blockAccess()
implementations since parent class does the same.blockBuild()
instead ofbuild()
, since that's the common case.'setting[label]'
on block settings form pages.This will probably need another round of documentation changes, but it's running tests locally, let's see what bot thinks.
PS: Also, I fixed first the other already added modules related with the type key on info files change.
Comment #16
marvil07 CreditAttribution: marvil07 commentedSome final changes for test to re-try before adding it.
Comment #18
marvil07 CreditAttribution: marvil07 commented#16: 1630760-16.patch queued for re-testing.
Comment #19
marvil07 CreditAttribution: marvil07 commentedLast patch added to 8.x-1.x.
Thank you all for the contributions here!
Also special thanks to timplunkett and xjm for the final hints ;-)