Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Drupal\name\Service; |
| 6 | |
| 7 | use Drupal\Core\Field\FieldDefinitionInterface; |
| 8 | |
| 9 | /** |
| 10 | * Autocomplete matches for name field components. |
| 11 | */ |
| 12 | interface AutocompleteInterface { |
| 13 | |
| 14 | /** |
| 15 | * Gets matches for the autocompletion of name components. |
| 16 | * |
| 17 | * @return array<string, string> |
| 18 | * Matching suggestion labels keyed by value. |
| 19 | */ |
| 20 | public function getMatches(FieldDefinitionInterface $field, string $target, string $string): array; |
| 21 | |
| 22 | /** |
| 23 | * Combines array values into an associative array keyed by value. |
| 24 | * |
| 25 | * @param array<int, string> $values |
| 26 | * Values to combine. |
| 27 | * |
| 28 | * @return array<string, string> |
| 29 | * Combined values. |
| 30 | */ |
| 31 | public function mapAssoc(array $values): array; |
| 32 | |
| 33 | /** |
| 34 | * Finds matching stored values for a single component of a name field. |
| 35 | * |
| 36 | * Strictly scoped to the supplied component's column of the field storage |
| 37 | * (same entity type + same field name) and filtered by entity view access. |
| 38 | * |
| 39 | * @param \Drupal\Core\Field\FieldDefinitionInterface $field |
| 40 | * The field definition. |
| 41 | * @param string $component |
| 42 | * Component machine name (for example, "given", "family"). |
| 43 | * @param string $term |
| 44 | * Case-insensitive search string typed by the user. |
| 45 | * @param int $limit |
| 46 | * Maximum number of unique values to return. |
| 47 | * @param string $mode |
| 48 | * Match mode: "starts_with" (default, indexable, recommended) or |
| 49 | * "contains" (substring match, non-indexable and slower on large sets). |
| 50 | * |
| 51 | * @return array<string, string> |
| 52 | * Matching values keyed by value. |
| 53 | */ |
| 54 | public function findFieldValues(FieldDefinitionInterface $field, string $component, string $term, int $limit, string $mode = 'starts_with'): array; |
| 55 | |
| 56 | } |