You are here

function _social_post_comment_post_comment_form_submit in Open Social 10.2.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_post/social_post.module \_social_post_comment_post_comment_form_submit()
  2. 8 modules/social_features/social_post/social_post.module \_social_post_comment_post_comment_form_submit()
  3. 8.2 modules/social_features/social_post/social_post.module \_social_post_comment_post_comment_form_submit()
  4. 8.3 modules/social_features/social_post/social_post.module \_social_post_comment_post_comment_form_submit()
  5. 8.4 modules/social_features/social_post/social_post.module \_social_post_comment_post_comment_form_submit()
  6. 8.5 modules/social_features/social_post/social_post.module \_social_post_comment_post_comment_form_submit()
  7. 8.6 modules/social_features/social_post/social_post.module \_social_post_comment_post_comment_form_submit()
  8. 8.7 modules/social_features/social_post/social_post.module \_social_post_comment_post_comment_form_submit()
  9. 8.8 modules/social_features/social_post/social_post.module \_social_post_comment_post_comment_form_submit()
  10. 10.3.x modules/social_features/social_post/social_post.module \_social_post_comment_post_comment_form_submit()
  11. 10.0.x modules/social_features/social_post/social_post.module \_social_post_comment_post_comment_form_submit()
  12. 10.1.x modules/social_features/social_post/social_post.module \_social_post_comment_post_comment_form_submit()

Form submit for comment_post_comment_form.

Parameters

array $form: Commnent on a post form.

\Drupal\Core\Form\FormStateInterface $form_state: Form state interface.

1 string reference to '_social_post_comment_post_comment_form_submit'
social_post_form_comment_post_comment_form_alter in modules/social_features/social_post/social_post.module
Implements hook_form_FORM_ID_alter().

File

modules/social_features/social_post/social_post.module, line 94
The Social post module.

Code

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

  // Fetch from the form.
  $uri = $form_state
    ->getValue('redirect_after_save');

  // Let's not trust this.
  $uri = Html::escape($uri);

  // Must be a valid URL.
  if (UrlHelper::isValid($uri)) {

    // Get the Url from the Form value and redirect to this url.
    $url = Url::fromUserInput($uri);

    // Set redirect.
    $form_state
      ->setRedirectUrl($url);
  }
}