search_api-8.x-1.15/modules/search_api_db/tests/search_api_db_test_autocomplete/src/Plugin/search_api_autocomplete/search/TestSearch.php
modules/search_api_db/tests/search_api_db_test_autocomplete/src/Plugin/search_api_autocomplete/search/TestSearch.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | <?php namespace Drupal\search_api_db_test_autocomplete\Plugin\search_api_autocomplete\search; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\PluginFormInterface; use Drupal\search_api_autocomplete\Search\SearchPluginBase; use Drupal\search_api_test\TestPluginTrait; /** * Defines a test type class. * * @SearchApiAutocompleteSearch( * id = "search_api_db_test_autocomplete", * label = @Translation("Autocomplete test module search"), * description = @Translation("Test autocomplete search"), * group_label = @Translation("Test search"), * group_description = @Translation("Searches used for tests"), * index = "database_search_index", * ) */ class TestSearch extends SearchPluginBase implements PluginFormInterface { use TestPluginTrait; /** * {@inheritdoc} */ public function buildConfigurationForm( array $form , FormStateInterface $form_state ) { $this ->logMethodCall( __FUNCTION__ , func_get_args()); if ( $override = $this ->getMethodOverride( __FUNCTION__ )) { return call_user_func( $override , $this , $form , $form_state ); } return []; } /** * {@inheritdoc} */ public function validateConfigurationForm( array & $form , FormStateInterface $form_state ) { $this ->logMethodCall( __FUNCTION__ , func_get_args()); if ( $override = $this ->getMethodOverride( __FUNCTION__ )) { call_user_func( $override , $this , $form , $form_state ); } } /** * {@inheritdoc} */ public function submitConfigurationForm( array & $form , FormStateInterface $form_state ) { $this ->logMethodCall( __FUNCTION__ , func_get_args()); if ( $override = $this ->getMethodOverride( __FUNCTION__ )) { call_user_func( $override , $this , $form , $form_state ); return ; } $this ->setConfiguration( $form_state ->getValues()); } /** * {@inheritdoc} */ public function createQuery( $keys , array $data = []) { $this ->logMethodCall( __FUNCTION__ , func_get_args()); if ( $override = $this ->getMethodOverride( __FUNCTION__ )) { return call_user_func( $override , $this , $keys , $data ); } return $this ->search->getIndex()->query()->keys( $keys ); } } |