Problem/Motivation
Unlike many other pages of core documentation, the Block API documentation doesn't contain a worked example.
Compare:
* https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Menu%21me...
* https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Routing%2...
* https://api.drupal.org/api/drupal/core%21core.api.php/group/form_api/8.2.x
* https://api.drupal.org/api/drupal/core%21modules%21block%21block.api.php...
While the Block API documentation links off to examples elsewhere in a contrib module, this is probably not great practice (and definitely not consistent with the other API docs.)
Proposed resolution
Add an example to block.api.php
Add sections.
Do not remove references to \Drupal\Core\Block\Annotation\Block. let's do that in a separate issue
Remaining tasks
Review
Commit
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #28 | 2798531-nr-bot.txt | 663 bytes | needs-review-queue-bot |
Issue fork drupal-2798531
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 2798531-add-example-to
changes, plain diff MR !8593
Comments
Comment #2
jp.stacey commentedPatch attached for discussion.
Comment #3
jp.stacey commentedComment #4
jp.stacey commentedPatch from #2 re-rolled as @kiwimind pointed out the embedded docblocks: no other worked examples have them, so I'm going to remove them to make the example simpler and avoid any issues with formatting docblocks within docblocks for api.drupal.org.
Comment #6
lomo commentedI don't think this should be filed as a "bug report", so I've changed it to a "Task". (Maybe I'm wrong about what qualifies as a "bug", but I personally wouldn't categorize "needed documentation improvements" as a "bug".)
That said, I also think this has been waiting for commit for far too long. The improvements from @jp.stacey look good to me. (I even set up a local Drupal 8 API server pointing to my local checkout of Drupal 8.x-4.x to verify that the documentation changes parse nicely and compared before/after versions of the affected file in a full-file diff-viewer to see everything in context.)
I think this can be set to RTBC and committed. Reviewing the rules for minor release changes, I think this should be allowable and should not need to wait for 8.4.x, therefore, I've also changed the version tag back to its previous value of 8.3.x-dev. This only affects documentation and basically only adds a bit more to the API docs, so it should be trivial enough not to require waiting for the next major release of Drupal 8. If I'm wrong about that, please correct me. ;-)
Comment #7
gábor hojtsyI have little familiarity with the example docs structures. So I went to check if this applies patterns used elsewhere:
I was assuming the example module would at least be appearing in other examples as well, but that does not seem to be the case. Is this docs section based off of some pattern or is it introducing a new one? How are code examples in other section represented?
Comment #16
amber himes matzLet's get this rerolled and then take another look at it.
Comment #17
Ankit.Gupta commentedReroll the patch #4 with Drupal 9.4.x
Comment #18
ranjith_kumar_k_u commentedFixed Cspell issue.
Comment #20
smustgrave commentedTo avoid an additional cspell word to keep track I think we should replace examplemodule with just example or module.
Comment #24
quietone commentedComment #25
quietone commentedComment #26
smustgrave commentedExample seems correct to me.
I opened #3458803: Remove reference to \Drupal\Core\Block\Annotation\Block (possibly more?) for the annotation removal. I left an open question on that ticket about scope range.
Comment #27
quietone commentedComment #28
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #29
quietone commentedComment #30
smustgrave commentedRestoring previous status before the bot.
Comment #34
nod_Committed c9db648 and pushed to 11.x. Thanks!