function comment_field_config_create
comment_field_config_create(FieldConfigInterface $field)
Implements hook_ENTITY_TYPE_create() for 'field_config'.
File
- core/modules/comment/comment.module, line 139
- Enables users to comment on published content.
Code
function comment_field_config_create(FieldConfigInterface $field) { if ($field->getType() == 'comment' && !$field->isSyncing()) { // Assign default values for the field. $default_value = $field->getDefaultValueLiteral(); $default_value += array(array()); $default_value[0] += array( 'status' => CommentItemInterface::OPEN, 'cid' => 0, 'last_comment_timestamp' => 0, 'last_comment_name' => '', 'last_comment_uid' => 0, 'comment_count' => 0, ); $field->setDefaultValue($default_value); } }
© 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/core!modules!comment!comment.module/function/comment_field_config_create/8.1.x