Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Error: Undefined constant "COMMENT_NODE_OPEN" when Comments are disabled #173

Closed
argiepiano opened this issue Apr 5, 2024 · 4 comments · Fixed by #174
Closed

Error: Undefined constant "COMMENT_NODE_OPEN" when Comments are disabled #173

argiepiano opened this issue Apr 5, 2024 · 4 comments · Fixed by #174

Comments

@argiepiano
Copy link
Collaborator

Originally reported on Zulip.

In certain conditions, for example, when using Views Bulk Operations, this error is thrown when:

  1. Creating a View of nodes
  2. Adding a VBO field
  3. Selecting "Modify entity values"
  4. Disabling the Comment module
  5. Selecting a node in the View and trying to execute the VBO action

The issue started with #149. (Mea culpa). The node property info 'comment' should not be added at this point. In fact, that property info is correctly added in the function entity_plus_metadata_comment_entity_property_info_alter() in the file comment.info.inc, which runs only if comment is enabled.

#149 was added as an attempt to allow for the three states of that property. In D7, this was a boolean (on/off). Now, in Backdrop, there are three possible states: COMMENT_NODE_OPEN, COMMENT_NODE_CLOSED and COMMENT_NODE_HIDDEN.

While the addition of these 3 states is correct, those should be have been as an option list callback in entity_plus_metadata_comment_entity_property_info_alter().

PR submitted in a moment.

@argiepiano
Copy link
Collaborator Author

@laryn, @hosef, PR provided and ready for testing and review.

I basically removed the comment node property info definition from node.info.inc, and modified the exiting comment node property definition in comment.info.inc to account for the fact that this property needs a select box with the three options for comments in Backdrop (open, closed, and closed & hidden).

Removing the property definition from node.info.inc prevents the fatal error that was reported above when the comment module was disabled.

@laryn
Copy link
Member

laryn commented Apr 9, 2024

@argiepiano Tested and reviewed. LGTM so I will go ahead and merge.

@Wylbur
Copy link

Wylbur commented Apr 17, 2024

We found this issue today while working with the Views Bulk Operations module. This also fixed our issue:
Error: Undefined constant "COMMENT_NODE_OPEN" in entity_plus_metadata_node_comment_settings_options_list() (line 137 of /home/wilbur/wbd/docroot/modules/entity_plus/modules/callbacks.inc).

Will this be added to a new release soon?

Thanks!

@argiepiano
Copy link
Collaborator Author

@laryn, @hosef, I think we should do a new release. Are you OK with that?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants