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.
Beta phase evaluation
Issue category | Task because we are moving the files from one place to another. |
---|---|
Issue priority | Normal because no changes. |
Problem/Motivation
It feels wrong that many of *.api.php (except system.api.php) is part of system module
Proposed resolution
move it inside lib/Drupal/Core
or
core
or
core/lib
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#17 | Move-Api-Files-From-System-Module-2401843-17.patch | 2.04 KB | lahoosascoots |
Comments
Comment #1
jhodgdonThis is a fine plan, although I think maybe it should just go in the top-level core directory, or maybe core/lib? I think it would be easier to find there.
We should also move the other *.api.php files in core/modules/system, like theme.api.php, etc. Only system.api.php is supposed to have stuff that is part of the System module itself... not that it actually does -- see #2299715: [meta] Move core hooks from system.api.php to core.api.php or other files, which still needs to be finished, and moves hooks from system.api.php to other files.
Comment #2
tadityar CreditAttribution: tadityar commentedUpdate Issue title and summary
Comment #3
tadityar CreditAttribution: tadityar commentedPostponed until several issues regarding core.api.php like [meta]#2299715 Move core hooks from system.api.php to core.api.php are fixed.
Comment #4
jhodgdonAll of the other issues have been resolved.
This can now be done, and I think it's a good idea. The question is where to move the *.api.php files. They do not belong in the System module (except system.api.php). But where?
Possible locations that may make sense:
core
core/lib
core/includes
core/documentation [new directory]
core/docs [new directory]
Any votes?
Comment #5
jhodgdonretitling
Comment #6
botrisI would vote for a dedicated (new) folder.
core/api [new directory] ?
Comment #7
jhodgdonI talked to @alexpott in IRC just now...
We think the best thing to do would be to move each file to near the code it is documenting.
Example:
database.api.php ==> core/lib/Drupal/Core/Database
This seems like it might be a good Novice issue... hopefully the patch will be small since it will just move a bunch of files. Use git mv and it should keep the patch tiny.
Oh and the core.api.php file can be moved to the top-level core directory.
Comment #8
lahoosascoots CreditAttribution: lahoosascoots as a volunteer commentedThis is what I've got so far.
Everything look good?
What about module.api.php and token.api.php?
Comment #9
jhodgdonExcellent! Those mostly look like good places for those files.
Let's see. The Token class is in core/lib/Drupal/Core/Utility, so we can put the token file there.
The module-related classes are in core/lib/Drupal/Core/Extension, so we can put the module file there.
And I think the theme.api.php file is mostly about the render system, so let's actually put that in core/lib/Drupal/Core/Render instead of Theme.
Thanks for the research; just need a patch!
Comment #10
lahoosascoots CreditAttribution: lahoosascoots as a volunteer commentedThis should do it.
Comment #11
lahoosascoots CreditAttribution: lahoosascoots as a volunteer commentedNevermind. That failed miserably for some reason.
Comment #12
lahoosascoots CreditAttribution: lahoosascoots as a volunteer commentedAll fixed. Not sure what banana I slipped on for that last one.
Comment #13
lahoosascoots CreditAttribution: lahoosascoots as a volunteer commentedComment #14
jhodgdonHm. Can you make a patch using "git mv" commands? It should be a lot smaller, like just saying the files are moved, rather than containing the entire text of all the files.
Comment #15
lahoosascoots CreditAttribution: lahoosascoots as a volunteer commentedI did use git mv and the above patch is what I ended up with.
Here are my steps:
Did I miss something from my normal process to fix this?
Comment #16
jhodgdonHm. I don't usually use the branch/commit workflow; I use git diff --cached. So I just tested with one file:
a) git mv core/modules/system/core.api.php core/core.api.php
b) git diff --cached
This ended up with a very small patch that looks like this:
Maybe you can try that?
Comment #17
lahoosascoots CreditAttribution: lahoosascoots as a volunteer commentedRound 3.
Comment #18
lahoosascoots CreditAttribution: lahoosascoots as a volunteer commentedComment #19
jhodgdonThanks! Looks good to me. I checked all the directories and I think they are the right places for those files. Assigning to @alexpott for final review/commit, since I discussed it with him earlier.
Comment #20
jhodgdonComment #23
chananapeeyush CreditAttribution: chananapeeyush as a volunteer and commentedPatch applied locally and tests also returned no errors.So retesting the patch.
Comment #24
jhodgdonComment #25
alexpottCommitted 0afbdd4 and pushed to 8.0.x. Thanks!
Docs are exempt from beta evaluation.