SaveComment.php

Contains \Drupal\comment\Plugin\Action\SaveComment.

Namespace

Drupal\comment\Plugin\Action

File

drupal/core/modules/comment/lib/Drupal/comment/Plugin/Action/SaveComment.php
View source
<?php

/**
 * @file
 * Contains \Drupal\comment\Plugin\Action\SaveComment.
 */
namespace Drupal\comment\Plugin\Action;

use Drupal\Core\Annotation\Action;
use Drupal\Core\Annotation\Translation;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Action\ActionBase;

/**
 * Saves a comment.
 *
 * @Action(
 *   id = "comment_save_action",
 *   label = @Translation("Save comment"),
 *   type = "comment"
 * )
 */
class SaveComment extends ActionBase {

  /**
   * {@inheritdoc}
   */
  public function execute($comment = NULL) {
    $comment
      ->save();
    Cache::invalidateTags(array(
      'content' => TRUE,
    ));
  }

}

Classes

Namesort descending Description
SaveComment Saves a comment.