function _comment_body_field_create
_comment_body_field_create($info)
Creates a comment_body field instance for a given node type.
File
- modules/comment/comment.module, line 362
- Enables users to comment on published content.
Code
function _comment_body_field_create($info) { // Create the field if needed. if (!field_read_field('comment_body', array('include_inactive' => TRUE))) { $field = array( 'field_name' => 'comment_body', 'type' => 'text_long', 'entity_types' => array('comment'), ); field_create_field($field); } // Create the instance if needed. if (!field_read_instance('comment', 'comment_body', 'comment_node_' . $info->type, array('include_inactive' => TRUE))) { field_attach_create_bundle('comment', 'comment_node_' . $info->type); // Attaches the body field by default. $instance = array( 'field_name' => 'comment_body', 'label' => 'Comment', 'entity_type' => 'comment', 'bundle' => 'comment_node_' . $info->type, 'settings' => array('text_processing' => 1), 'required' => TRUE, 'display' => array( 'default' => array( 'label' => 'hidden', 'type' => 'text_default', 'weight' => 0, ), ), ); field_create_instance($instance); } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!comment!comment.module/function/_comment_body_field_create/7.x