You are here

function _social_album_comment_submit in Open Social 10.2.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_album/social_album.module \_social_album_comment_submit()
  2. 10.0.x modules/social_features/social_album/social_album.module \_social_album_comment_submit()
  3. 10.1.x modules/social_features/social_album/social_album.module \_social_album_comment_submit()

Open the page of a post after adding a comment to the post on the album page.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

1 string reference to '_social_album_comment_submit'
social_album_form_comment_form_alter in modules/social_features/social_album/social_album.module
Implements hook_form_FORM_ID_alter().

File

modules/social_features/social_album/social_album.module, line 422
The Social Album module.

Code

function _social_album_comment_submit(array $form, FormStateInterface $form_state) {

  /** @var \Drupal\comment\CommentInterface $comment */
  $comment = $form_state
    ->getFormObject()
    ->getEntity();
  $url = $comment
    ->getCommentedEntity()
    ->toUrl()
    ->setOption('fragment', 'comment-' . $comment
    ->id());
  $form_state
    ->setRedirectUrl($url);
}