Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / comment / comment.module
index bb203bf64419e05c7420a58a6ceeda36b43b84e9..78f857057df6f61d6a68ae3df376f512eb3c02ea 100644 (file)
@@ -25,6 +25,7 @@ use Drupal\field\FieldConfigInterface;
 use Drupal\field\FieldStorageConfigInterface;
 use Drupal\node\NodeInterface;
 use Drupal\user\RoleInterface;
+use Drupal\user\UserInterface;
 
 /**
  * Anonymous posters cannot enter their contact information.
@@ -268,7 +269,7 @@ function comment_node_view_alter(array &$build, EntityInterface $node, EntityVie
  *   content language of the current request.
  *
  * @return array
- *   An array as expected by drupal_render().
+ *   An array as expected by \Drupal\Core\Render\RendererInterface::render().
  *
  * @deprecated in Drupal 8.x and will be removed before Drupal 9.0.
  *   Use \Drupal::entityManager()->getViewBuilder('comment')->view().
@@ -291,12 +292,13 @@ function comment_view(CommentInterface $comment, $view_mode = 'full', $langcode
  *   Defaults to NULL.
  *
  * @return array
- *   An array in the format expected by drupal_render().
+ *   An array in the format expected by
+ *   \Drupal\Core\Render\RendererInterface::render().
  *
  * @deprecated in Drupal 8.x and will be removed before Drupal 9.0.
  *   Use \Drupal::entityManager()->getViewBuilder('comment')->viewMultiple().
  *
- * @see drupal_render()
+ * @see \Drupal\Core\Render\RendererInterface::render()
  */
 function comment_view_multiple($comments, $view_mode = 'full', $langcode = NULL) {
   return entity_view_multiple($comments, $view_mode, $langcode);
@@ -517,12 +519,12 @@ function comment_node_search_result(EntityInterface $node) {
 /**
  * Implements hook_user_cancel().
  */
-function comment_user_cancel($edit, $account, $method) {
+function comment_user_cancel($edit, UserInterface $account, $method) {
   switch ($method) {
     case 'user_cancel_block_unpublish':
       $comments = entity_load_multiple_by_properties('comment', ['uid' => $account->id()]);
       foreach ($comments as $comment) {
-        $comment->setPublished(CommentInterface::NOT_PUBLISHED);
+        $comment->setUnpublished();
         $comment->save();
       }
       break;
@@ -558,7 +560,7 @@ function comment_user_predelete($account) {
  *   The current state of the form.
  *
  * @return array
- *   An array as expected by drupal_render().
+ *   An array as expected by \Drupal\Core\Render\RendererInterface::render().
  */
 function comment_preview(CommentInterface $comment, FormStateInterface $form_state) {
   $preview_build = [];