I'm not sure this is really a bug, since when the module is enabled the content type does appear. However, if one looks at blog.install and forum.install one will see:

  // Ensure the blog node type is available.
  node_types_rebuild();
  $types = node_type_get_types();

inside one of the functions.

Comments

vegantriathlete’s picture

Status:Needs work» Active

Sorry, I guess I should have left the status as active.

GoZ’s picture

I think there is no need to check that poll node type exists.

In blog and forum, this code permit to attach body field instance to their own content type. Since poll does not use existing fields, there is no need to call

node_types_rebuild();
$types = node_type_get_types();
greggles’s picture

Project:Drupal core» Poll (from core)
Version:7.x-dev» 8.x-1.x-dev
Component:poll.module» Code
typhonius’s picture

Poll by default doesn't have a body field. if the default poll content type were to have a body field then something like

<?php
  node_types_rebuild
();
 
$types = node_type_get_types();
 
node_add_body_field($types['poll']);
?>

would be feasible to use.

Should the question therefore be: Should poll have a body field?

typhonius’s picture

typhonius’s picture

Issue summary:View changes
Status:Active» Postponed

Poll in 8.x won't be reliant on node since it's its own entity. This one may be ripe for moving back to Core > Poll in the future.

typhonius’s picture

Project:Poll (from core)» Drupal core
Version:8.x-1.x-dev» 7.x-dev
Component:Code» poll.module

Moving back to 7.x Core -> Poll as the 8.x poll module doesn't have a dependency on the node system.

dcam’s picture

Status:Postponed» Active
dcam’s picture

Status:Active» Closed (works as designed)

This works as designed. That code just seems to be there to ensure that the node type is actually available before attaching fields to it because errors would be thrown if not. If I had to make an educated guess, it needed to be added to blog_install() because the rest of the module's hooks, including blog_node_info(), probably weren't even invoked yet. So I doubt the node type would normally be available at that stage. It's probably less necessary for the forum module, since the body field is attached in forum_enable(). I could be wrong about all that, but the point is that since Poll doesn't have fields, it's not necessary.