Hello,
This module is using node_type_class module's library and data but it does not provide dependency on this module. It generates errors like:

User warning: The following theme is missing from the file system: node_type_class in drupal_get_filename() (line 276 of core/includes/bootstrap.inc).

Could you please add a dependency or remove this module usage from the code (or add a few checking before the module's logic usage?)
Thank you.

Command icon 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:

Comments

zvse created an issue. See original summary.

imyaro’s picture

I've made a fast patch to avoid notices, but it is just a workaround, I think that it should be resolved other way.

imyaro’s picture

Patch for current stable version (8.1.2) (Prev is for dev one)

saltednut’s picture

There 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

vlklavanya’s picture

Status: Active » Needs review
StatusFileSize
new322 bytes

Its better to have node_type_class as a dependency for this module. Adding a patch.

gueguerreiro’s picture

Version: 8.x-1.2 » 8.x-1.4
Status: Needs review » Needs work

I 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":

$type->setThirdPartySetting('node_type_class', 'classes', $form_state->getValue('nodetype_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.

alison’s picture

We'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_class is 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??

heikkiy’s picture

There 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.

AstonVictor made their first commit to this issue’s fork.

astonvictor’s picture

Version: 8.x-1.4 » 2.0.0
Assigned: Unassigned » astonvictor

astonvictor’s picture

Assigned: astonvictor » Unassigned
Status: Needs work » Needs review

Created 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.

heikkiy’s picture

Status: Needs review » Needs work

I 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.

astonvictor’s picture

Status: Needs work » Needs review

.

heikkiy’s picture

I 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.

astonvictor’s picture

Hi @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 .module file.

heikkiy’s picture

@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.

astonvictor’s picture

FYI made another MR as well that only contains changes to remove all code related to the 'node_type_class'.

heikkiy’s picture

Status: Needs review » Reviewed & tested by the community

The second smaller MR looks good to me.

+1 for RTBC for those changes.

astonvictor’s picture

hi @Jitendra verma,

any updates? could you review and merge it?