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.
Introduction:
Note: This issue is is only meant for planning / sign-offs. Any work or issues will happen in child issues : please add them here!
This was originally a stand-alone issue but was converted to a [Meta] issue. See "Original Issue Description" for the original issue contents reported by @kalinchernev.
Sub-issues:
Original Issue Description:
- Fix code formatting
- Remove deprecated functions that are converted to methods
- Remove unnecessary code
Comments
Comment #2
mh86 CreditAttribution: mh86 as a volunteer and at jobiqo - job board technology commentedHi Kalin,
thanks for pushing your code. I was just reviewing it (http://cgit.drupalcode.org/taxonomy_manager/commit/?h=improvement/262440...).
There is one "code style" I would not change, although I know PHPStorm does that automatically for you:
or
So in your version every method call gets a separate line. I think it makes the code longer (more lines), and as long as the single-line-statement is not far too long, also more difficult to read. Furthermore core uses the single-line statement too, as far as I can see.
Apart from that, everything looks good :) Thanks a lot! And don't wait to merge it into the main branch, otherwise you might have to fix conflicts with my commits in the meanwhile ;)
Comment #3
mh86 CreditAttribution: mh86 as a volunteer and at jobiqo - job board technology commentedApart from the code style itself, I found some other areas we should address
Comment #4
kalinchernev CreditAttribution: kalinchernev as a volunteer commentedHi Matthias, thanks for your review!
I didn't notice that PHPStorm is putting the chained methods on new lines. I fixed them and merged back to the main branch. For cases of many chained methods, I broke them down to smaller steps to be more readable.
During the fixes, I left taxonomy_manager_voc_list method intact (didn't convert to lowerCamel as required), everything breaks and I don't know how to debug/solve the issue in D8 for now... In the past I left it intact on purpose of easy reference to existing code. To be changed before release.
Class names - I agree, it will simplify things. Few ideas:
- TaxonomyManagerController could be just Main and taxonomy_manager_voc_list could be maybe just list, then the route will result in _controller: '\Drupal\taxonomy_manager\Controller\Main::list'. Could also be Vocabulary as there's no much there right now. Vocabulary is more abstract and will be better fit if we would provide basic operations on vocabularies. Not sure whether if it's ok to skip the Controller in the end when it's under Controller folder.
- TaxonomyManagerSubTreeController -> SubTree or SubTreeController
- TaxonomyManagerTree -> Tree or TreeElement
- TaxonomyManagerAdmin -> AdminForm
- TaxonomyManagerForm -> TreeForm
- TaxonomyManagerHelper - this might end up being replaced/moved to more specific places in classes that uses them. And the methods are having the old function names still to keep the track, but should be different.
Paths in routes - yes, makes sense.
Directory structure - yes, and remove old/ in addition?
Documentation and CS - yes, absolutely. I'd love to do that continuously.
Comment #6
mh86 CreditAttribution: mh86 as a volunteer and at jobiqo - job board technology commentedThanks for pushing your changes, they look good :)
Regarding the class naming, before we change anything I will do some more research too, see if there is some documentation on class naming conventions and ask others. My ideas are similar to yours and I would also add the type (Controller / Element / Form / ...) at the end of the class name, like TreeElement (so you immediately know this class is about a form element)
For the rest, feel free to directly push your changes to the main branch.
@Directory structure - yes, and remove old/ in addition?
-> Yes, remove the old stuff. Then it's also easier to use http://pareview.sh/
Comment #7
mh86 CreditAttribution: mh86 as a volunteer and at jobiqo - job board technology commentedRegarding the class naming, this is the documentation I was able to find:
https://www.drupal.org/node/2156625
https://www.drupal.org/node/1353118
Comment #10
kalinchernev CreditAttribution: kalinchernev as a volunteer commentedHi, I thank you! :)
Few updates have been pushed regarding this topic:
- js files reorganized
- 2 controllers refactored
Please run `drush cr` :)
Comment #11
mh86 CreditAttribution: mh86 as a volunteer and at jobiqo - job board technology commentedThanks for the updates!
Regarding the class naming, also talked to klausi, so let's keep them short (without TaxonomyManager in general, as we have the namespace), but still it should be clear what it does, so just "Main" might be too generic.
My thoughts on naming:
src
What do you think?
Comment #12
kalinchernev CreditAttribution: kalinchernev as a volunteer commentedHi Matthias, yes, sounds good.
Comment #13
mh86 CreditAttribution: mh86 as a volunteer and at jobiqo - job board technology commentedMaybe VocabularyOverviewController?
Agreed :)
Comment #14
kalinchernev CreditAttribution: kalinchernev as a volunteer commentedYes, looks/sounds good :)
I'll continue on the refactoring in the next days as agreed so far, but let me know if you come up with better ideas in the meantime.
Comment #15
JacobSanfordI opened a separate ticket for array format cleanup:
#2959667: Convert use of array() to short form.
Comment #16
JacobSanfordComment #17
JacobSanfordAs mentioned in #2960831: Migrate from drupal_set_message(), this issue is quite broad in scope. Since all patches have been committed in THIS issue, I feel converting into a Meta issue would increase clarity and help get the cleanup moving in a more orderly manner.
Comment #18
JacobSanfordComment #19
JacobSanfordComment #20
VladimirAus