You are here

function social_album_form_social_post_entity_form_alter 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_form_social_post_entity_form_alter()
  2. 10.0.x modules/social_features/social_album/social_album.module \social_album_form_social_post_entity_form_alter()
  3. 10.1.x modules/social_features/social_album/social_album.module \social_album_form_social_post_entity_form_alter()

Implements hook_form_FORM_ID_alter().

File

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

Code

function social_album_form_social_post_entity_form_alter(&$form, FormStateInterface $form_state, $form_id) {

  /** @var \Drupal\social_post\Entity\PostInterface $post */
  $post = $form_state
    ->getFormObject()
    ->getEntity();
  if ($post
    ->bundle() === 'photo' && $post
    ->isNew() && $form_state
    ->get('form_display')
    ->getMode() === 'group') {
    $form['actions']['submit']['#submit'][] = '_social_album_post_submit';
  }
}