Problem/Motivation
Here is the paragraph in the top-level README.txt file for Drupal 8.2.x:
Drupal contains an extensive API that allows you to add to and modify the
functionality of your site. The API consists of "hooks", which allow modules to
react to system events and customize Drupal's behavior, and functions that
standardize common operations such as database queries and form generation. The
flexible hook architecture means that you should never need to directly modify
the files that come with Drupal core to achieve the functionality you want;
instead, functionality modifications take the form of modules.
Um. Hooks and functions. Really?
There is no mention of classes, plugins, routing, or anything else that really makes up our API these days.
Proposed resolution
I think maybe this paragraph needs an update.
One other thing... I think we should change the api.drupal.org URL that is at the bottom of this section from explicitly being https://api.drupal.org/api/drupal/8 to just https://api.drupal.org -- that will somewhat future-proof the file.
Remaining tasks
Needs patch drafting new paragraph
User interface changes
None needed
API changes
None needed
Data model changes
None needed
| Comment | File | Size | Author |
|---|---|---|---|
| #29 | 2707163-29.patch | 1.77 KB | quietone |
Comments
Comment #2
andrewhdI am working to triage this issue.
Comment #3
jdelvillar01 commentedI am working on triaging this issue
Comment #4
jdelvillar01 commentedComment #5
andrewhdComment #6
andrewhdInserted template and formatted jhodgdon's original issue, no UI/API/Model changes seem to be needed for this issue
Comment #7
xjmThanks @AndrewHD and @jdelvillar01; I take it from your comments that you confirmed this is still an issue with the README (which it is indeed). Updating credit.
Comment #8
xjmAs a documentation bugfix, this change is eligible for patch releases.
Comment #9
chishah92 commentedComment #10
chishah92 commentedHave updated the readme.txt of drupal 8.2.x according to your suggestions and also have changed to URL in the bottom section for API. Please give suggestions if any.
Thanks!
~Chirag
Comment #11
jhodgdonThanks! This is a good start. A few problems:
a) The paragraph really needs more modification. The second sentence (see issue summary) starts off by talking about only hooks, which are really not at all central to the current Drupal 8 API. So, it needs a rewrite starting there. The alteration mechanisms available to modules in Drupal 8 are:
- Hooks
- Plugins
- Dependency injection
- Events
b) Several of the lines in the patch end in spaces. You need to remove all end-of-line spaces. Most programming editors have settings for either highlighting or removing end-of-line spaces, and if you plan to continue working on patches for Drupal, one of those settings is very useful.
Comment #12
chishah92 commentedHave done more modifications in the paragraph , adding descriptions regarding dependency injection and events and removing the spaces at end-of-line. I hope these changes are valid ones
Thanks!
~Chirag
Comment #13
xjmThanks for starting on this @chishah92 (and thanks @jhodgdon for reporting the issue).
@alexpott,@webchick, @catch, @effulgentsia, @Cottser, and I discussed this and agreed this could just be considered a normal priority docs bug. The information it is giving is not technically wrong, just... incomplete. (There are definitely other major documentation bugs in core, but this is not one I think.)
From @chishah92's starting patch, it seems to me that a lot of this information is ending up duplicating existing information in the codebase and on the web. The page at https://api.drupal.org/api/drupal is a thorough list of topics, thanks to work by @jhodgdon and others during Drupal 8's development. So, rather than writing up another overview of the APIs, I think it would instead be better to remove the stuff about "hooks and functions" and refer people directly to the extending topic (see https://www.drupal.org/node/1354#link for how). Then, we can update the link to the comprehensive overview on api.d.o as @jhodgdon suggests, and that should provide them with enough information on how to start.
Comment #21
quietone commentedThe README.txt was updated in #3192842: Make our README more welcoming by converting it into an "entrypoint" into the Drupal ecosystem and the text here is now in USAGE.txt.
#13. Removed the hooks and functions section and added a link to the extending page, in the same format used in this file. That is, it doesn't use an @link.
Not testing the patch because it is comments.
Comment #22
quietone commentedComment #23
quietone commentedAnd I forgot to update the title.
Comment #24
quietone commentedUnassigning because it has been 5 years.
Comment #25
dwwTherefore, RTBC!
Thanks,
-Derek
Comment #26
alexpottI agree that linking to the API is much more useful here.
What's missing is the bit about
I do think that somewhere we need to keep something that says don't hack core. Maybe we can add this to the "Overview of extensions and alteration methods for Drupal." section of core.api.php which is how the content that's linked to is generated.
Comment #27
quietone commentedThis patch restores the important bit about not hacking core. It does not restore the part and hook and functions because I think this is a high level introductory document. Anyone needing to write code will start reading elsewhere for details of the API.
No interdiff because this is so small.
Comment #28
dwwI know we're restoring the existing text, so maybe this should just go in as-is. But with the shortened version, it repeats "functionality" a lot. How about this?
Comment #29
quietone commented@dww, thanks. I think your version is better. I've updated the patch (no interdiff due to size) and started the tests.
Comment #30
dwwGreat, thanks! #26 is fixed. No further concerns with #29. Back to RTBC! 🎉
Comment #31
alexpottCommitted and pushed c304842b8e to 9.4.x and 93f0416955 to 9.3.x. Thanks!