Mercurial > hg > isophonics-drupal-site
comparison core/modules/comment/src/Plugin/Action/SaveComment.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 1fec387a4317 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\comment\Plugin\Action; | |
4 | |
5 use Drupal\Core\Action\ActionBase; | |
6 use Drupal\Core\Session\AccountInterface; | |
7 | |
8 /** | |
9 * Saves a comment. | |
10 * | |
11 * @Action( | |
12 * id = "comment_save_action", | |
13 * label = @Translation("Save comment"), | |
14 * type = "comment" | |
15 * ) | |
16 */ | |
17 class SaveComment extends ActionBase { | |
18 | |
19 /** | |
20 * {@inheritdoc} | |
21 */ | |
22 public function execute($comment = NULL) { | |
23 $comment->save(); | |
24 } | |
25 | |
26 /** | |
27 * {@inheritdoc} | |
28 */ | |
29 public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { | |
30 /** @var \Drupal\comment\CommentInterface $object */ | |
31 return $object->access('update', $account, $return_as_object); | |
32 } | |
33 | |
34 } |