You are here

function hook_social_post_message_alter in Open Social 10.1.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_post/social_post.api.php \hook_social_post_message_alter()
  2. 10.0.x modules/social_features/social_post/social_post.api.php \hook_social_post_message_alter()
  3. 10.2.x modules/social_features/social_post/social_post.api.php \hook_social_post_message_alter()

Provide a method to alter a message about creating a new post.

Parameters

\Drupal\Core\StringTranslation\TranslatableMarkup $message: The message.

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

See also

\Drupal\social_post\Form\PostForm::save()

1 function implements hook_social_post_message_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

social_album_social_post_message_alter in modules/social_features/social_album/social_album.module
Implements hook_social_post_message_alter().
1 invocation of hook_social_post_message_alter()
PostForm::save in modules/social_features/social_post/src/Form/PostForm.php
Form submission handler for the 'save' action.

File

modules/social_features/social_post/social_post.api.php, line 83
Hooks provided by the Social Post module.

Code

function hook_social_post_message_alter(TranslatableMarkup &$message, FormStateInterface $form_state) {
  $post = $form_state
    ->getFormObject()
    ->getEntity();
  if (mb_strlen($post->field_post->value) > 1000) {
    $message = t('Your long post has been posted.');
  }
}