Mercurial > hg > isophonics-drupal-site
comparison core/modules/comment/src/Plugin/Action/SaveComment.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
1 <?php | 1 <?php |
2 | 2 |
3 namespace Drupal\comment\Plugin\Action; | 3 namespace Drupal\comment\Plugin\Action; |
4 | 4 |
5 use Drupal\Core\Action\ActionBase; | 5 use Drupal\Component\Datetime\TimeInterface; |
6 use Drupal\Core\Session\AccountInterface; | 6 use Drupal\Core\Action\Plugin\Action\SaveAction; |
7 use Drupal\Core\Entity\EntityTypeManagerInterface; | |
7 | 8 |
8 /** | 9 /** |
9 * Saves a comment. | 10 * Saves a comment. |
11 * | |
12 * @deprecated in Drupal 8.5.x, to be removed before Drupal 9.0.0. | |
13 * Use \Drupal\Core\Action\Plugin\Action\SaveAction instead. | |
14 * | |
15 * @see \Drupal\Core\Action\Plugin\Action\SaveAction | |
16 * @see https://www.drupal.org/node/2919303 | |
10 * | 17 * |
11 * @Action( | 18 * @Action( |
12 * id = "comment_save_action", | 19 * id = "comment_save_action", |
13 * label = @Translation("Save comment"), | 20 * label = @Translation("Save comment"), |
14 * type = "comment" | 21 * type = "comment" |
15 * ) | 22 * ) |
16 */ | 23 */ |
17 class SaveComment extends ActionBase { | 24 class SaveComment extends SaveAction { |
18 | 25 |
19 /** | 26 /** |
20 * {@inheritdoc} | 27 * {@inheritdoc} |
21 */ | 28 */ |
22 public function execute($comment = NULL) { | 29 public function __construct($configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, TimeInterface $time) { |
23 $comment->save(); | 30 parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager, $time); |
24 } | 31 @trigger_error(__NAMESPACE__ . '\SaveComment is deprecated in Drupal 8.5.x, will be removed before Drupal 9.0.0. Use \Drupal\Core\Action\Plugin\Action\SaveAction instead. See https://www.drupal.org/node/2919303.', E_USER_DEPRECATED); |
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 } | 32 } |
33 | 33 |
34 } | 34 } |