social_event_invite_flow-1.0.0-beta3/src/Form/InviteMessagesForm.php
src/Form/InviteMessagesForm.php
<?php
namespace Drupal\social_event_invite_flow\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Provides a Social event invite flow form.
*/
class InviteMessagesForm extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'social_event_invite_flow_invite_messages';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form['message'] = [
'#type' => 'textarea',
'#title' => $this->t('Message'),
'#required' => TRUE,
];
return $form;
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
if (mb_strlen($form_state->getValue('message')) < 10) {
$form_state->setErrorByName('message', $this->t('Message should be at least 10 characters.'));
}
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
}
}
