1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace Drupal\materio_sapi\Form;
- use Drupal\Core\Form\FormBase;
- use Drupal\Core\Form\FormStateInterface;
- /**
- * Class MaterioSapiSearchForm.
- */
- class MaterioSapiSearchForm extends FormBase {
- /**
- * {@inheritdoc}
- */
- public function getFormId() {
- return 'materio_sapi_search_form';
- }
- /**
- * {@inheritdoc}
- */
- public function buildForm(array $form, FormStateInterface $form_state) {
- $form['search'] = [
- '#type' => 'textfield',
- // '#title' => $this->t('Search'),
- '#maxlength' => 64,
- '#size' => 25,
- '#weight' => '0',
- '#attributes' => [
- "placeholder" => $this->t('Search'),
- ],
- '#autocomplete_route_name' => 'materio_sapi.search_autocomplete',
- ];
- $form['submit'] = [
- '#type' => 'submit',
- '#value' => $this->t('Search'),
- ];
- return $form;
- }
- /**
- * {@inheritdoc}
- */
- public function validateForm(array &$form, FormStateInterface $form_state) {
- parent::validateForm($form, $form_state);
- }
- /**
- * {@inheritdoc}
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- // Display result.
- foreach ($form_state->getValues() as $key => $value) {
- drupal_set_message($key . ': ' . $value);
- }
- }
- }
|