Reviewed & tested by the community
Project:
Custom Body Class
Version:
2.0.0
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 May 2019 at 04:43 UTC
Updated:
3 May 2024 at 08:50 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
imyaro commentedI've made a fast patch to avoid notices, but it is just a workaround, I think that it should be resolved other way.
Comment #3
imyaro commentedPatch for current stable version (8.1.2) (Prev is for dev one)
Comment #4
saltednutThere was another issue around this that is closed (fixed) but it doesn't actually seem to be fixed.
#3026806: Remove node-type-class feature from module
Comment #5
vlklavanya commentedIts better to have node_type_class as a dependency for this module. Adding a patch.
Comment #6
gueguerreiroI took a look at this, and it seems that, while the dependency does exists, I can't figure out why it would be necessary.
When saving the class settings, we seem to be using the variable from "node_type_class":
But we don't have to do this, even if we use the "node_type_class" module (Which should be redundant if we're already using this module anyway), there are no advantages to reusing the same variable.
I tested the functionality as-is and the "node_type_class" module also seems to have some bugs when saving the node type form, and requires a patch to work properly: https://www.drupal.org/project/node_type_class/issues/3040389. Which is less than ideal if we want to set this as a dependency that gets installed automatically. We have no way to flag the user that he now also needs to add a patch to a separate module.
The JS that gets added with the library is to update the summary in the sidebar for the node type edit form. It's a nice to have, but not enough to warrant a module depencency. We can put that functionality in the module directly instead.
I'll try to decouple the node_type_class features from our module, and set up an update hook to migrate the data from the variable "node_type_class" into something more specific to this module.
But the idea is to remove the dependency completely, so I'm setting this to NW.
Comment #7
alisonWe've got both custom_body_class and node_type_class modules on a site we're onboarding, and things get a little hinky when you try to fill in one or the other on the content type settings form.
**Total speculation** BUT I wonder if this module was created from a copy of the node_type_class module, and some stuff got accidentally left behind, and/or some stuff didn't get "found-and-replaced" during initial module development?
node_type_classis the name of the field on the content type settings form in the node_type_class module:https://git.drupalcode.org/project/node_type_class/-/blob/e880d11d2f42bc...
So, that needs to be changed (and an update hook added).
OR... hear me out... the per-content-type class setting could be removed from custom_body_class, and users could be advised to add node_type_class to get that functionality -- and custom_body_class could be used exclusively for per-node body classes. Ehh??
Comment #8
heikkiy commentedThere is an open merge request to fix the issue in issue https://www.drupal.org/project/custom_body_class/issues/3026806. It seems like that issue has been closed accidentally and cannot be reopened without the maintainer.
We have been using the patch for a long time without problems. It seems like it still is mergeable to the latest version: https://git.drupalcode.org/project/custom_body_class/-/merge_requests/2.
Comment #10
astonvictor commentedComment #12
astonvictor commentedCreated a new MR.
Replaced 'node_type_class' settings with 'custom_body_class' in order not to have a conflict with Node type class module.
We should also do it because
getThirdPartySetting()method uses the module name as a first parameter.I also fixed validation functions for node/node_type forms.
Since we updated the storage for classes, changes should be added to a new version of the module or we should create an update function to move settings from node_type_class to custom_body_class.
Let me know what you think about it. thanks.
Comment #13
heikkiy commentedI checked the merge request and to me it seems like it has really many unrelated and outside of scope changes.
The original patch I mentioned in #8 only deals with the wrong dependency: https://www.drupal.org/files/issues/2019-01-18/remove-node-type-class-fe...
The merge request here https://git.drupalcode.org/project/custom_body_class/-/merge_requests/5/... seems to do a lot more like move help texts around etc. Should these be handled in this issue because the issue title does not really contain it or would it make sense to only fix the original issue and create new issue(s) for the other fixes?
I would suggest creating a new issue to fix the validation errors.
It would make it easier to review this PR.
Comment #14
astonvictor commented.
Comment #15
heikkiy commentedI think the validation and code quality issues should have a new ticket and create the fixes there. It will be easier to track where and why the changes happened because now the issue title No dependency on the Node type class module does not cover those changes.
Comment #16
astonvictor commentedHi @HeikkiY,
the module should not have any dependencies. that's why I removed all code related to node_type_class.
https://www.drupal.org/files/issues/2019-01-18/remove-node-type-class-fe... - It just removes the possibility tp add classes per bundle. Why we should delete it from the module? and it doesn't contain changes related to the validation callback.
as for me, the MR is not so complicated. the module only has one
.modulefile.Comment #17
heikkiy commented@astonvictor I don't feel comfortable marking this as reviewed, sorry. You are for example changing the whole module description in this MR which is definitely outside of this issues scope.
Maybe we need to wait for the maintainer to comment on this.
Comment #19
astonvictor commentedFYI made another MR as well that only contains changes to remove all code related to the 'node_type_class'.
Comment #20
heikkiy commentedThe second smaller MR looks good to me.
+1 for RTBC for those changes.
Comment #21
astonvictor commentedhi @Jitendra verma,
any updates? could you review and merge it?