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 | use Drupal\Core\Field\FieldItemListInterface; |
| 9 | use Drupal\Core\StringTranslation\TranslatableMarkup; |
| 10 | use Drupal\Core\Url; |
| 11 | |
| 12 | /** |
| 13 | * Resolves formatter link targets and URLs for name fields. |
| 14 | * |
| 15 | * @internal |
| 16 | */ |
| 17 | interface LinkTargetInterface { |
| 18 | |
| 19 | /** |
| 20 | * Finds linkable field targets for a name formatter. |
| 21 | * |
| 22 | * @param \Drupal\Core\Field\FieldDefinitionInterface $fieldDefinition |
| 23 | * The name field definition. |
| 24 | * @param \Drupal\Core\StringTranslation\TranslatableMarkup $entityUrlLabel |
| 25 | * Label for the owning entity URL option. |
| 26 | * |
| 27 | * @return array<string, \Drupal\Core\StringTranslation\TranslatableMarkup|string> |
| 28 | * Target machine names keyed to labels. |
| 29 | */ |
| 30 | public function getTargets( |
| 31 | FieldDefinitionInterface $fieldDefinition, |
| 32 | TranslatableMarkup $entityUrlLabel, |
| 33 | ): array; |
| 34 | |
| 35 | /** |
| 36 | * Gets the URL for a configured link target. |
| 37 | * |
| 38 | * @param \Drupal\Core\Field\FieldItemListInterface $items |
| 39 | * The name field item list. |
| 40 | * @param string $linkTarget |
| 41 | * The configured link target machine name. |
| 42 | * |
| 43 | * @return \Drupal\Core\Url |
| 44 | * The resolved URL, or a no-link route when none applies. |
| 45 | */ |
| 46 | public function resolveUrl(FieldItemListInterface $items, string $linkTarget): Url; |
| 47 | |
| 48 | } |