Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. CommentWidget.php

function CommentWidget::massageFormValues

Overrides WidgetBase::massageFormValues

File

core/modules/comment/src/Plugin/Field/FieldWidget/CommentWidget.php, line 91

Class

CommentWidget
Provides a default comment widget.

Namespace

Drupal\comment\Plugin\Field\FieldWidget

Code

public function massageFormValues(array $values, array $form, FormStateInterface $form_state) {
    // Add default values for statistics properties because we don't want to
    // have them in form.
    foreach ($values as &$value) {
        $value += [
            'cid' => 0,
            'last_comment_timestamp' => 0,
            'last_comment_name' => '',
            'last_comment_uid' => 0,
            'comment_count' => 0,
        ];
    }
    return $values;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal