|
|
|
@ -6,6 +6,8 @@ use Drupal\Core\Form\FormBase;
|
|
|
|
|
use Drupal\Core\Form\FormStateInterface; |
|
|
|
|
use Drupal\Component\Utility\Html; |
|
|
|
|
use Drupal\Core\Url; |
|
|
|
|
use Drupal\message\Entity\Message; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Config form for module |
|
|
|
@ -66,7 +68,11 @@ class RoblibSearchForm extends FormBase{
|
|
|
|
|
public function submitForm(array &$form, FormStateInterface $form_state) { |
|
|
|
|
$search_string = $form_state->getValue('roblib_search_simple_search_query'); |
|
|
|
|
$search_string = Html::escape($search_string); |
|
|
|
|
//roblib_search_log_query($search_string); |
|
|
|
|
$message = Message::create(['template' => 'roblib_search_message_template', |
|
|
|
|
'uid' => \Drupal::currentUser()->id()]); |
|
|
|
|
$message->set('field_ip_address', \Drupal::request()->getClientIp()); |
|
|
|
|
$message->set('field_search_string', $search_string); |
|
|
|
|
$message->save(); |
|
|
|
|
$url = Url::fromUserInput('/roblib_search/' . $search_string); |
|
|
|
|
$form_state->setRedirectUrl($url); |
|
|
|
|
} |
|
|
|
|